formatAmount static method

String formatAmount(
  1. num amount, {
  2. String symbol = '₹',
  3. String locale = defaultLocale,
  4. int decimalDigits = 0,
})

Formats a non-null amount using Indian currency grouping.

Implementation

static String formatAmount(
  num amount, {
  String symbol = '₹',
  String locale = defaultLocale,
  int decimalDigits = 0,
}) {
  try {
    final formatter = NumberFormat.currency(
      locale: locale,
      symbol: symbol,
      decimalDigits: decimalDigits,
    );
    return formatter.format(amount);
  } catch (_) {
    return fallback;
  }
}