Flutter: How to Format Numbers as Currency Strings

Updated: September 13, 2023 By: A Goodman Post a comment


In order to format numbers as currency strings in Dart and Flutter, we can make use of the NumberFormat class provided by a well-known, official package named intl. There are several constructors for the job.

If you want compact currency representations (like $9.99M), use this:

  String? locale, 
  String? name, 
  String? symbol, 
  int? decimalDigits

If you want compact currency representations (like $1k, $3M, etc.), which will automatically determine a currency symbol based on the currency name or the locale, use this:

  String? locale, 
  String? name, 
  int? decimalDigits

This constructor uses the simple symbol for the currency if one is available ($, €, ¥, ₹, đ, etc.):

  String? locale, 
  String? name, 
  int? decimalDigits

If you want to get currency representations that use the locale currency pattern, use this:

   String? locale, 
   String? name, 
   String? symbol, 
   int? decimalDigits, 
   String? customPattern

Let’s examine a couple of examples to get a better understanding of these things.

The First Example

The code:

// kindacode.com
// main.dart
import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:intl/intl.dart';

void main() {
  if (kDebugMode) {
    // United States
    print(NumberFormat.simpleCurrency(locale: 'EN-us', decimalDigits: 2)
    print(NumberFormat.simpleCurrency(name: 'USD').format(1000));

    // United Kingdom
    print(NumberFormat.simpleCurrency(locale: 'en-GB').format(1000));

    // Japan
    print(NumberFormat.simpleCurrency(locale: 'ja-JP', decimalDigits: 2)

    // India
    print(NumberFormat.simpleCurrency(locale: 'hi-IN', decimalDigits: 2)

    // China
    print(NumberFormat.simpleCurrency(locale: 'zh-CN', decimalDigits: 2)

    // Korea
    print(NumberFormat.simpleCurrency(locale: 'ko-KR', decimalDigits: 2)

    // Vietnam
    print(NumberFormat.simpleCurrency(locale: 'vi-VN', decimalDigits: 2)
    print(NumberFormat.simpleCurrency(name: 'VND', decimalDigits: 2)


10.000,00 ₫

The Second Example


The code:

// main.dart
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

void main() {
  runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  Widget build(BuildContext context) {
    return MaterialApp(
      // Remove the debug banner
      debugShowCheckedModeBanner: false,
      title: 'KindaCode.com',
      theme: ThemeData(useMaterial3: true),
      home: const HomeScreen(),

class HomeScreen extends StatelessWidget {
  const HomeScreen({Key? key}) : super(key: key);
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('KindaCode.com')),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: DefaultTextStyle(
          style: const TextStyle(
              fontSize: 30, color: Colors.blue, fontWeight: FontWeight.bold),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              // US
              Text(NumberFormat.compactCurrency(locale: 'en-US')

              // India
              Text(NumberFormat.compactSimpleCurrency(locale: 'hi-IN')

              // Brazil
              Text(NumberFormat.compactSimpleCurrency(locale: 'pt-BR')

              // China Mainland
              Text(NumberFormat.compactSimpleCurrency(locale: 'zh-CN')

              // Japan
              Text(NumberFormat.compactSimpleCurrency(locale: 'ja')

              // Thailand
              Text(NumberFormat.currency(locale: 'th-TH').format(10000000)),

              // Indonesia
              Text(NumberFormat.compactSimpleCurrency(locale: 'id-ID')

The List of Locales

For your reference, here’s the list of locale codes:



You’ve learned how to display product prices in nice formats with the help of the NumberFormat class. As of now, you’ll have a handy solution to get through that task. If you’d like to explore more new and exciting stuff in Flutter, take a look at the following articles:

You can also tour around our Flutter topic page or Dart topic page for the most recent tutorials and examples.

Notify of
Inline Feedbacks
View all comments

Related Articles