Skip to main content

number_formatter_plus 1.0.0 copy "number_formatter_plus: ^1.0.0" to clipboard
number_formatter_plus: ^1.0.0 copied to clipboard

A lightweight Dart package for formatting numbers, currency, percentages, and compact values.

number_formatter_plus #

A lightweight Dart package for formatting numbers, currency, percentages, and compact values.

Features #

  • Format numbers with thousands separators.
  • Format currency with customizable symbols.
  • Display compact numbers such as 1.2K, 1.5M, and 2.0B.
  • Format percentages with configurable decimal precision.
  • Customize decimal and thousands separators.
  • No external runtime dependencies.

Installation #

Run the following command in your Flutter project:

flutter pub add number_formatter_plus

For Dart-only projects:

dart pub add number_formatter_plus

Usage #

Import the package:

import 'package:number_formatter_plus/number_formatter_plus.dart';

Format numbers #

NumberFormatter.format(1250000);
// 1,250,000

NumberFormatter.format(1250.50, decimalDigits: 2);
// 1,250.50

Format currency #

NumberFormatter.currency(1250.50, symbol: '₱');
// ₱1,250.50

NumberFormatter.currency(5000, symbol: '\$');
// $5,000.00

Compact numbers #

NumberFormatter.compact(1200);
// 1.2K

NumberFormatter.compact(1500000);
// 1.5M

NumberFormatter.compact(2000000000);
// 2.0B

Format percentages #

NumberFormatter.percentage(85.5);
// 85.50%

NumberFormatter.percentage(85.5, decimalDigits: 0);
// 86%

Custom separators #

NumberFormatter.format(
  1250000,
  thousandSeparator: '.',
);
// 1.250.000

Run tests #

dart test

License #

This project is licensed under the MIT License.

4
likes
160
points
355
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight Dart package for formatting numbers, currency, percentages, and compact values.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on number_formatter_plus