fmtNumCompact function
Abbreviates large numbers (idle/tycoon-scale coin balances) as
1.5K/2.4M/10.8B/1T, one decimal place, trailing .0 dropped.
Below 1000 falls back to fmtNum (locale-aware thousands separator).
Implementation
String fmtNumCompact(num n) {
final abs = n.abs();
for (final (threshold, suffix) in _compactUnits) {
if (abs >= threshold) {
final scaled = n / threshold;
var text = scaled.toStringAsFixed(1);
if (text.endsWith('.0')) text = text.substring(0, text.length - 2);
return '$text$suffix';
}
}
return fmtNum(n.toInt());
}