significant_format 0.0.2 icon indicating copy to clipboard operation
significant_format: ^0.0.2 copied to clipboard

This package provides a SignificantFormat class which formats a double value in significant figure in roundup or truncate mode. If locale is provided in input, the number will be formatted with thousa [...]

significant_format #

This package provides a SignificantFormat class which formats a double value in significant figure in roundup or truncate mode. If locale is provided in input, the number will be formatted with thousands separator (, or .) according to the locale provided.

Buy Me A Coffee

Getting Started #

In your flutter project add the dependency:

dependencies: 
 ... 
 significant_format:

Usage example #

import 'package:significant_format/significant_format.dart'

void main() {
 // format 0.000012345 with 4 significant figure using truncate
 // formatted = 0.00001234 
 String formatted = SignificantFormat().truncate(0.000012345, 4);

 // format 12345 with 4 significant figure using roundup
 // formatted = 12350
 String formatted = SignificantFormat().roundup(12345, 4);

 // pass optional locale will format the value as amount which containing thousands separator
 // amount = 12,350
 String amount = SignificantFormat().roundup(12345, 4, locale: "en");
}
1
likes
80
pub points
0%
popularity

Publisher

unverified uploader

This package provides a SignificantFormat class which formats a double value in significant figure in roundup or truncate mode. If locale is provided in input, the number will be formatted with thousands separator (, or .) according to the locale provided.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

flutter, intl

More

Packages that depend on significant_format