PerfTestFormat constructor

PerfTestFormat({
  1. String? borderFormat = '+-',
  2. String lineFormat = '| $stubFieldName | $stubFieldRatio | $stubFieldValue |',
  3. num? infinity = 9999.99,
  4. bool isQuiet = false,
  5. bool isRaw = false,
  6. PerfTestPrinter printer = print,
  7. String quote = '"',
  8. String quoteEscaped = '""',
  9. bool usePercent = false,
  10. DateFormat? dateFormat,
  11. NumberFormat? numberFormat,
  12. NumberFormat? percentFormat,
})

The constructor

Implementation

PerfTestFormat(
    {String? borderFormat = '+-',
    this.lineFormat =
        '| $stubFieldName | $stubFieldRatio | $stubFieldValue |',
    this.infinity = 9999.99,
    this.isQuiet = false,
    this.isRaw = false,
    this.printer = print,
    this.quote = '"',
    this.quoteEscaped = '""',
    this.usePercent = false,
    DateFormat? dateFormat,
    NumberFormat? numberFormat,
    NumberFormat? percentFormat}) {
  if ((borderFormat != null) && borderFormat.isNotEmpty) {
    cornerChar = borderFormat[0];
    horBarChar = borderFormat[borderFormat.length - 1];
  } else {
    cornerChar = '';
    horBarChar = '';
  }

  this.dateFormat = dateFormat ?? DateFormat();
  this.numberFormat = numberFormat ?? NumberFormat();

  if (percentFormat != null) {
    this.percentFormat = percentFormat;
  } else if (usePercent) {
    this.percentFormat = NumberFormat.percentPattern();
  } else {
    this.percentFormat = NumberFormat('#,##0.00');
  }

  final nonStub = lineFormat.replaceAll(stubRE, '');
  fieldSeparator = (nonStub.isEmpty ? ' ' : nonStub[0]);
}