FixedNumberPrinter<T extends num> constructor
FixedNumberPrinter<T extends num> ({})
Prints numbers in a custom fixed format.
Implementation
FixedNumberPrinter({
this.accuracy,
this.base = 10,
this.characters = NumeralSystem.latin,
this.delimiter = delimiterString,
this.infinity = infinityString,
this.nan = nanString,
this.padding = 0,
this.precision = 0,
this.separator = '',
this.separatorWidth = 3,
this.separatorOffset = 0,
Printer<T>? sign,
}) : assert(base <= characters.length, 'Not enough characters for base'),
sign = sign ?? SignNumberPrinter<T>.omitPositiveSign(),
_integer = const Printer<String>.standard()
.mapIf(
padding > 0,
(printer) => printer.padLeft(padding, characters[0]),
)
.mapIf(
separator.isNotEmpty && separatorWidth > 0,
(printer) => printer.separateRight(
separatorWidth,
separatorOffset,
separator,
),
),
_fraction = const Printer<String>.standard()
.mapIf(
precision > 0,
(printer) => printer.padLeft(precision, characters[0]),
)
.mapIf(
separator.isNotEmpty && separatorWidth > 0,
(printer) => printer.separateLeft(
separatorWidth,
separatorOffset,
separator,
),
);