byte_converter 2.6.0
byte_converter: ^2.6.0 copied to clipboard
High-performance byte and data-rate conversions with BigInt precision, expression parsing, transfer planning, storage profiles, and localization-ready formatting.
π’ 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