-
Notifications
You must be signed in to change notification settings - Fork 1
Home
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 • Namespace APIs for display, comparison, accessibility, bit operations, and byte division • Advanced utilities: bandwidth tracking, cache alignment, pluralization
— Latest version: 2.6.0 — SDK: Dart >= 3.0.0
- 🚀 Getting started → Getting-Started
- 📦 Usage & examples → Usage
- 🎛️ Formatting options → Formatting
- 🧮 Parsing strings → Parsing
- 📶 Data rates → Data-Rate
- 🧱 BigInt and arbitrary precision → BigInt
- 🧩 Extensions (int/double/BigInt) → Extensions
- 🧰 Utilities (display, compare, accessibility) → Utilities
- 📚 API reference → API-Reference
- 🧪 Edge cases → Edge-Cases
- ❓ FAQ → FAQ
- 🧯 Troubleshooting → Troubleshooting
- 🍳 Recipes → Recipes
- 📝 Changelog → Changelog
// Core functionality (most use cases)
import 'package:byte_converter/byte_converter.dart';
// Full library: statistics, streaming, interop adapters
import 'package:byte_converter/byte_converter_full.dart';
// Localization with intl package
import 'package:byte_converter/byte_converter_intl.dart';
// Lightweight (no intl dependency)
import 'package:byte_converter/byte_converter_lite.dart';import 'package:byte_converter/byte_converter.dart';
void main() {
final file = ByteConverter.fromMegaBytes(1500); // 1500 MB
// Namespace API (recommended)
print(file.display.auto()); // "1.5 GB"
print(file.display.fuzzy()); // "about 1.5 GB"
// Parse a size (with expressions!)
final parsed = ByteConverter.parse('2 GiB + 512 MiB');
print(parsed.display.auto(standard: ByteStandard.iec)); // "2.5 GiB"
// Data rate formatting
final rate = DataRate.megaBitsPerSecond(100);
print(rate.toHumanReadableAuto()); // "100 Mb/s"
// Namespace APIs
print(file.compare.percentOf(ByteConverter.fromGigaBytes(10))); // 15.0
print(file.accessibility.screenReader()); // "one point five gigabytes"
}- 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, forceUnit, and locale-aware number formatting
- Namespace APIs for display formats, comparisons, accessibility, and structured output
- 9 built-in languages: English, German, French, Spanish, Portuguese, Hindi, Japanese, Chinese, Russian
- Utility classes for relative time, SI numbers, ordinals, validation, and bit operations
- Powerful parsing resilient to spaces/commas/underscores with expression support (
"1 GB + 512 MB") - 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.5.0 (Dart SDK >= 3.0.0).
| Import | Contents |
|---|---|
byte_converter.dart |
Core: ByteConverter, DataRate, namespaces, extensions, BigByteConverter
|
byte_converter_full.dart |
All: ByteStats, TDigest, StreamInstrumentation, InteropAdapters, FormatterSnapshot
|
byte_converter_intl.dart |
Localization with intl package |
byte_converter_lite.dart |
Lightweight, no intl dependency |
Continue with Getting-Started to install and run your first snippets.