data_size 0.2.0 data_size: ^0.2.0 copied to clipboard
🔟 Customizable data size (bit & byte) formatting for interfacing with the user
🔟 Customizable data size (bit & byte) formatting for interfacing with the user
Features #
- format
DataUnit.bit
andDataUnit.byte
- select a prefix:
Prefix.decimal
(kB, MB, … with multiples of 1000)Prefix.binary
(KiB, MiB, … with multiples of 1024)
- select a precision (number of decimal places)
Examples #
final defaultString = 12345.formatByteSize(); // "12.35 kB"
final noDecimalPlaces = 12345.formatByteSize(precision: 0); // "12 kB"
final binaryPrefix = 12345.formatByteSize(prefix: Prefix.binary); // "12.06 KiB"
final bits = 12345.formatBitSize(); // "12.35 kb"