Skip to content
Arun Prakash edited this page Sep 21, 2025 · 12 revisions

byte_converter Wiki ✨

Welcome to the byte_converter wiki! This is your guide to converting and formatting bytes, bits, and data rates in Dart with both simple and advanced controls.

• Easy conversions (KB, MB, GB… and KiB, MiB, GiB) • Human‑readable formatting with SI/IEC/JEDEC standards • Parse strings like "1.5 GB", "2GiB", or "100 Mbps" • BigInt support for ultra‑large values (YB, ZiB…) • Extensions on int/double/BigInt for fluent usage

— Latest version: 2.2.0 — SDK: Dart >= 3.0.0

🔗 Quick links

🚀 Quick start

Tip: You can add a logo or banner under images/ and reference it here like [[images/logo.png]].

import 'package:byte_converter/byte_converter.dart';

void main() {
	final file = ByteConverter.fromMegaBytes(1500); // 1500 MB

	// Human readable auto (SI by default)
	print(file.toHumanReadableAuto()); // e.g., "1.5 GB"

	// Choose a unit
	print(file.toHumanReadable(SizeUnit.GB)); // "1.5 GB"

	// Parse a size
	final parsed = ByteConverter.parse('2 GiB', standard: ByteStandard.iec);
	print(parsed.toHumanReadableAuto(standard: ByteStandard.iec)); // "2 GiB"

	// Data rate formatting
	final rate = DataRate.megaBitsPerSecond(100);
	print(rate.toHumanReadableAuto()); // "100 Mb/s"
}

✨ Highlights

  • Three standards: SI (kilo), IEC (kibi), and JEDEC (binary multipliers with KB, MB, GB symbols)
  • Flexible formatting: precision, spacing, full‑form names, min/max fraction digits, signed values, and forceUnit
  • Powerful parsing resilient to spaces/commas/underscores, handles bits vs bytes, and unit words (e.g., "megabytes")
  • BigInt counterpart covers enormous numbers precisely with rounding controls
  • Convenient extensions for fluent usage: 10.gibiBytes, 500.kiloBytes, BigInt.from(1).yottaBytes, etc.

Version compatibility: This wiki targets byte_converter v2.2.0 (Dart SDK >= 3.0.0). Features match tests in this repository branch.

Continue with Getting-Started to install and run your first snippets.

Welcome to the byte_converter wiki!

Clone this wiki locally