money static method
Currency from MINOR units — cents, pence — so app data carries integers
and never a float that drifts. cents: false rounds half up to whole
units where the decimals are noise (a headline total,
a price chip). The sign leads the symbol: -$12.00.
Implementation
static String money(
int minorUnits, {
String symbol = r'$',
bool cents = true,
}) {
final negative = minorUnits < 0;
final absolute = minorUnits.abs();
final whole = absolute ~/ 100;
final remainder = absolute % 100;
final body = cents
? '${_grouped(whole)}.${remainder.toString().padLeft(2, '0')}'
: _grouped(remainder >= 50 ? whole + 1 : whole);
return '${negative ? '-' : ''}$symbol$body';
}