CustomPrettyPrinter constructor

CustomPrettyPrinter({
  1. int stackTraceBeginIndex = 0,
  2. int methodCount = 2,
  3. int errorMethodCount = 8,
  4. int lineLength = 120,
  5. bool colors = true,
  6. bool printEmojis = true,
  7. bool printTime = false,
  8. Map<Level, bool> excludeBox = const {},
  9. bool noBoxingByDefault = false,
})

Implementation

CustomPrettyPrinter({
  this.stackTraceBeginIndex = 0,
  this.methodCount = 2,
  this.errorMethodCount = 8,
  this.lineLength = 120,
  this.colors = true,
  this.printEmojis = true,
  this.printTime = false,
  this.excludeBox = const {},
  this.noBoxingByDefault = false,
}) {
  _startTime ??= DateTime.now();

  var doubleDividerLine = StringBuffer();
  var singleDividerLine = StringBuffer();
  for (var i = 0; i < lineLength - 1; i++) {
    doubleDividerLine.write(doubleDivider);
    singleDividerLine.write(singleDivider);
  }

  _topBorder = '$topLeftCorner$doubleDividerLine';
  _middleBorder = '$middleCorner$singleDividerLine';
  _bottomBorder = '$bottomLeftCorner$doubleDividerLine';

  // Translate excludeBox map (constant if default) to includeBox map with all Level enum possibilities
  includeBox = {};
  Level.values.forEach((l) => includeBox[l] = !noBoxingByDefault);
  excludeBox.forEach((k, v) => includeBox[k] = !v);
}