-
Notifications
You must be signed in to change notification settings - Fork 1
BigInt
Arun Prakash edited this page Nov 29, 2025
·
2 revisions
Use BigByteConverter for arbitrary precision conversions and formatting.
final x = BigByteConverter(BigInt.from(1024));
final y = BigByteConverter.fromYottaBytes(BigInt.from(1));x.toHumanReadable(BigSizeUnit.KB); // "1 KB"
x.toHumanReadableAuto(standard: ByteStandard.iec); // "1 KiB"- Exact integer getters (e.g.,
kiloBytesExact) returnBigIntdivisions - Double getters (e.g.,
kiloBytes) are convenient for UI but can lose precision on huge values
final a = BigByteConverter(BigInt.from(4000));
final b = a.roundToBlock(); // -> 4096 B
final sum = a + BigByteConverter(BigInt.from(24));
final half = a ~/ BigInt.from(2);final p = BigByteConverter.parse('1.2 GiB',
standard: ByteStandard.iec,
rounding: RoundingMode.floor,
);final n = BigByteConverter(BigInt.from(1024)).toByteConverter();
final b = BigByteConverter.fromByteConverter(ByteConverter(1024));