🔟 Customizable data size (bit & byte) formatting for interfacing with the user

Build, Test & Lint Coverage

Features

  • format DataUnit.bit and DataUnit.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"

Libraries

data_size