๐ข ByteConverter
A fast, comprehensive byte & data-rate conversion library for Dart
๐ Documentation ยท ๐ Report Bug ยท ๐ก Request Feature
โจ Features
| Feature | Description | |
|---|---|---|
| ๐ | Multi-Standard | SI (KB, MB, GB), IEC (KiB, MiB, GiB), and JEDEC support |
| ๐ | Smart Parsing | Parse any format: "1.5 GB", "2 GiB + 512 MiB", "1,234 bytes" |
| ๐ข | BigInt Support | Arbitrary precision for massive values (YB, ZiB, and beyond) |
| ๐ | Data Rates | Full bits/bytes per second with transfer time estimation |
| ๐ | 9 Languages | Built-in localization: EN, DE, FR, ES, PT, HI, JA, ZH, RU |
| ๐ฏ | Clean API | Namespace-based: display, storage, rate, compare, accessibility |
| โฟ | Accessible | Screen reader friendly output & ARIA labels |
| ๐ | Statistics | Streaming quantiles, percentiles, and aggregation |
๐ Quick Start
Installation
dependencies:
byte_converter: ^2.5.0
Basic Usage
import 'package:byte_converter/byte_converter.dart';
void main() {
// ๐ฆ Create from any unit
final size = ByteConverter.fromGigaBytes(1.5);
// ๐จ Display formats
print(size.display.auto()); // "1.5 GB"
print(size.display.fuzzy()); // "about 1.5 GB"
print(size.display.gnu()); // "1.5G"
// ๐ Parse strings (even expressions!)
final parsed = ByteConverter.parse('2 GiB + 512 MiB');
print(parsed.gigaBytes); // 2.68...
// ๐ Data rates & transfer estimation
final rate = DataRate.parse('100 Mbps');
final plan = size.estimateTransfer(rate);
print(plan.etaString()); // "~2 minutes"
}
๐ฆ Import Options
// ๐ฏ Core (most use cases)
import 'package:byte_converter/byte_converter.dart';
// ๐ฅ Full (statistics, streaming, interop)
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';
๐ฏ Namespace API
final size = ByteConverter.fromMegaBytes(1536);
// ๐จ Display - formatting options
size.display.auto() // "1.5 GB"
size.display.fuzzy() // "about 1.5 GB"
size.display.scientific() // "1.5 ร 10โน B"
// ๐พ Storage - disk alignment
size.storage.sectors // 3000000 (512B sectors)
size.storage.blocks // 375000 (4KB blocks)
// ๐ก Rate - network calculations
size.rate.bitsPerSecond // 12884901888.0
size.rate.transferTime(rate) // Duration
// ๐ Compare - size comparisons
size.compare.percentOf(total) // 15.0
size.compare.percentageBar(total) // "โโโโโโโโโโ"
// โฟ Accessibility
size.accessibility.screenReader() // "one point five gigabytes"
๐ Documentation
| Resource | Description |
|---|---|
| ๐ Wiki | Full documentation |
| ๐ Getting Started | Installation & setup |
| ๐ Usage Guide | Core functionality |
| ๐งฐ Utilities | Advanced features |
| ๐ Migration Guide | Upgrading to v2.5.0 |
Made with โค๏ธ for the Dart community
Libraries
- byte_converter
- Provides a simple interface for conversion of Digital values such as Bytes, KiloBytes etc.
- byte_converter_full
- Full byte conversion library with all features.
- byte_converter_intl
- Byte converter with full internationalization support.
- byte_converter_lite