pretty_num 0.0.2
pretty_num: ^0.0.2 copied to clipboard
A lightweight Dart library to format ugly numbers into clean, readable strings like 1.5M, 1,234,567, or 2.4 MB.
A lightweight Dart library to format ugly numbers into clean, readable strings like compact suffixes (1.5M), thousand separators (1,234,567), and byte sizes (1.2 MB).
Features #
toCompact(): Converts large numbers into readable abbreviations (1.5K,2.5M,1.0B).toReadable(): Formats numbers with custom thousand separators (1 234 567or1,234,567).toBytes(): Converts raw bytes into human-readable sizes (512 B,1.5 KB,2.4 MB).
Usage #
import 'package:pretty_num/pretty_num.dart';
void main() {
print(1500.toCompact()); // 1.5K
print(1234567.toReadable()); // 1 234 567
print(1048576.toBytes()); // 1.0 MB
}