format method
Implementation
@override
String format(Decimal decimal) {
List<String> parts = decimal.doubleValue
.toStringAsFixed(precision)
.replaceAll('.', '')
.replaceAll('-', '')
.split('')
.reversed
.toList();
int start = precision + 4;
if (precision > 0) {
parts.insert(precision, decimalSeparator);
} else {
start = 3;
}
for (int pos = start; parts.length > pos; pos += 4) {
parts.insert(pos, thousandSeparator);
}
if (decimal.doubleValue < 0) {
parts.add('-');
}
return parts.reversed.join();
}