'Flutter: How To display Currency In Indian Numbering Format?

have a question about formatting the Rupee currency (Indian Rupee - INR).

For example, numbers here are represented as:

1

10

100

1,000

10,000

1,00,000

10,00,000

1,00,00,000

10,00,00,000

But not able to find any reference library where I can separate comma number in Indian formate.



Solution 1:[1]

You can use Intl package as follow:

    var format = NumberFormat.currency(locale: 'HI');
    print(format.format(100000000));//10,00,00,000.00

Solution 2:[2]

You can use Intl package as follow:

final indianRupeesFormat = NumberFormat.currency(
           name: "INR",
           locale: 'en_IN',
           decimalDigits: 0, // change it to get decimal places
           symbol: '? ',
        );

Or, You can format any number as you want:

final numberFormatter = NumberFormat(
                            "##,##,###", 
                            "en_US",     // local US
                          )

An Extension to format numbers into Indian currency format:

extension RupeesFormatter on int {
     String inRupeesFormat() {
        return indianRupeesFormat.format(this);
     }
}

use it like this:

Text(
     2000.inRupeesFormat(),  // output:  ? 2,000
 ),

Solution 3:[3]

Use locale 'en_IN' for English Indian formatting and 'HI' for Hindi Indian formatting

var indiaFormat = NumberFormat.compactCurrency(locale: 'HI');
print(indiaFormat.format(1000000));//10 ???

var indiaFormat = NumberFormat.compactCurrency(locale: 'en_IN');
print(indiaFormat.format(1000000));//10L

Solution 4:[4]

If you want to show amount with ? symbol then use the following code:

Text(
   NumberFormat.currency(
      symbol: '? ',
      locale: "HI",
      decimalDigits: 3,
   ).format(amount),
),

Don't forget to import the intl package.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Haidar
Solution 2
Solution 3 Sumith
Solution 4 Aman Kumar Singh