compactBlockCount function
Compact block-count formatter (1,579,873 → "1.6M"), locale-aware (#317: the
old locale-DEFAULT static froze to whatever Intl.defaultLocale was at
first use — an "1.6M" inside a ru sentence). locale is
WalletLocalizations.of(context).localeName, so the digits follow the
strings around them. Built once PER LOCALE (a formatter per rebuild is
wasteful even at the badge's low update rate; the cache is bounded by the
app's locale set).
Implementation
String compactBlockCount(int count, String locale) => _compactBlockFmts
.putIfAbsent(locale, () => NumberFormat.compact(locale: locale))
.format(count);