A Dart library for Format number into beautiful string, Format the number into a beautiful, readable and short string.
Add this to your package's pubspec.yaml file:
dependencies:
numeral: latest
Using it is very simple! Just chain call the numeral()
method or
beautiful
attribute after your number (num
/int
/double
)!
import 'package:numeral/numeral.dart';
void main() {
print(1000.numeral()); // -> 1K
print(1000.beautiful); // -> 1K
}
digits
(default:3
): The number of digits to appear after the decimal point.builder
(default:NumeralUnit.value
): The function to build the suffix.
import 'package:numeral/numeral.dart';
Numeral.digits = 2;
Numeral.builder = (unit) => '<Your custom suffix>';
This library is licensed under the MIT License.