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

A Dart package for formatting quantities, percentages, and monetary values. Removes trailing zeros and adds thousand separators with ease.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.0.0 - 2025-01-01 #

Added #

  • NumMXFormatterExtension — extension on num that adds .moneyFormat(), .qtyFormat() and .percentFormat() directly to every int and double value, enabling a concise fluent call-site syntax:
    • 102321121.moneyFormat()"102 321 121"
    • 10.12123123.qtyFormat()"10.12"
    • 10.0.percentFormat()"10%"

Added #

  • QuantityFormatter.format() — formats a double value by rounding to a maximum number of decimal places and removing trailing zeros.
    • 10.12123123"10.12"
    • 10.0"10"
  • QuantityFormatter.formatPercent() — same as format() with a % suffix.
    • 10.12123123"10.12%"
    • 10.0"10%"
  • MoneyFormatter.format() — formats a double as a monetary amount using space as the thousand separator and trimming trailing decimal zeros.
    • 102321121"102 321 121"
    • 10321121.21"10 321 121.21"
  • Configurable maxDecimalPlaces, thousandSeparator, and decimalSeparator parameters on all formatters.
  • Full null-safe, pure-Dart implementation — supports Android, iOS, Linux, macOS, Web, and Windows without any additional dependencies.
0
likes
160
points
6
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Dart package for formatting quantities, percentages, and monetary values. Removes trailing zeros and adds thousand separators with ease.

Repository (GitHub)
View/report issues

Topics

#formatting #numbers #utilities #money

License

MIT (license)

More

Packages that depend on mx_formatter