toCompactCurrency method

String toCompactCurrency(
  1. String currency
)

Implementation

String toCompactCurrency(String currency) {
  final symbol = CurrencyExtensions.symbolOf(currency);
  if (this >= 1000000000)
    return '$symbol${(this / 1000000000).toStringAsFixed(1)}Mr';
  if (this >= 1000000)
    return '$symbol${(this / 1000000).toStringAsFixed(1)}M';
  if (this >= 1000) return '$symbol${(this / 1000).toStringAsFixed(1)}B';
  return toCurrency(currency);
}