Formating price cheat sheet

Flutter tips Published on

Need to show prices nicely in your Flutter app? The intl package makes it super easy!

Get Started

First, make sure you add the intl package to your pubspec.yaml file and import it:

import 'package:intl/intl.dart';

Common Formatting Methods

Here are some common ways to format numbers as currency:

Specific Locale and Symbol

NumberFormat.currency(locale: 'en_US', symbol: '\$').format(12.2);
// Result: $12.2

Default Locale Formatting

If you don't specify a locale, it uses the device's settings.

NumberFormat.currency().format(12.2);
// Result could be US 12.2 or EUR 12.2 depending on the device locale

Without Decimal Digits

Just want a whole number price?

NumberFormat.currency(decimalDigits: 0).format(12.2);
// Result: US 12 (symbol may vary by locale)

Simple Currency Format

NumberFormat.simpleCurrency().format(12.2);
// Result: $12.2

Compact Format for Large Numbers

Great for showing large values in a shorter way.

NumberFormat.compactSimpleCurrency().format(12000000);
// Result: $1.2M

Using these simple methods from the intl package, you can display prices in many different formats easily!

Save 3 months of work

Create your app using our 6 years of making Flutter apps and more than 50+ apps

kickstarter for flutter apps

Frequently Asked Questions

What Flutter package is used for formatting prices?

You can use the `intl` package to format prices in Flutter.

How do I format currency for a specific country like the US?

Use `NumberFormat.currency(locale: 'en_US', symbol: '$').format(yourNumber);`

Can I format a price without showing decimal places?

Yes, use `NumberFormat.currency(decimalDigits: 0).format(yourNumber);`

How do I show large price numbers in a shorter format like $1.2M?

Use the `NumberFormat.compactSimpleCurrency().format(yourLargeNumber);` method.

Read more
You may also be interested in
Go Beyond Material: Add Custom Colors in your Flutter Theme  blog card image
Go Beyond Material: Add Custom Colors in your Flutter Theme
Published on 2025-05-12T08:49:42.146Z
Automatically create a new Apple Store version  blog card image
Automatically create a new Apple Store version
Published on 2025-05-12T09:03:39.549Z
ApparenceKit is a flutter template generator tool by Apparence.io © 2025.
All rights reserved