byte_converter 2.4.2
byte_converter: ^2.4.2 copied to clipboard
High-performance byte and data-rate conversions with BigInt precision, expression parsing, transfer planning, storage profiles, and localization-ready formatting.
Changelog #
2.4.2 #
Added / Improved #
- Package-wide public API documentation completed and enforced via
public_member_api_docs. - Clarified docs across
BigByteConverter,ByteConverter, compound formatting, parse results, storage profiles, and unified parsing types. - Resolved all analyzer warnings; repository is analyzer-clean.
Notes #
- No functional changes. This is a documentation-only release to improve API discoverability and consistency.
2.4.1 #
Added / Improved #
- Compound mixed-unit formatting (e.g.,
toHumanReadableCompound) now honorsCompoundFormatOptions.useGroupingandlocaleto render integers with locale-aware thousands separators (viaintl). This especially improves IEC outputs where counts can exceed 999 (for example,1,023 MiB). - Expanded Dartdoc for compound formatting options and behavior.
- README polish: added a friendly intro/personality, richer examples, and centered the title/badges for a more inviting presentation.
Notes #
- No breaking API changes. This is a visual formatting enhancement only. SI compound counts typically remain below 1000 per part; IEC benefits most from grouping.
2.4.0 #
Added / Improved #
- Fixed-width alignment for the numeric portion via
ByteFormatOptions.fixedWidth(also supported inDataRate.toHumanReadableAuto). includeSignInWidthoption to count the sign when padding withfixedWidthfor tighter column alignment.- Pattern formatting token
Sto explicitly render the sign ('+', '-', or space whensigned=true). - CLI:
bytecgains--fixed-width ninformatandratecommands; help updated.ratealso exposes--perfor choosing time base. - Docs: expanded formatting guide and data-rate examples to cover NBSP, truncation, SI k-case, fixed width, and pattern
S.
Notes #
- Default SI kilo symbol remains
KBfor backward compatibility; opt intokBusingsiKSymbolCase: lowerKor--si-lower-kin CLI.
2.3.1 #
Fixed #
- Size and data-rate parsing now fall back across SI, IEC, and JEDEC symbols so expression evaluation accepts mixed-unit inputs regardless of the selected standard.
2.3.0 #
Added / Improved #
- Transfer planning helpers (
TransferPlan,DataRate.transferableBytes,BigDataRate.transferableBytes) with ETAs, remaining payload metrics, and friendly strings. - Storage alignment profiles that round converters to device-specific blocks and surface slack diagnostics.
ByteStats/BigByteStatsaggregations for sums, averages, percentiles, and histogram buckets across mixed inputs.- Composite expression parsing for sizes and rates, including arithmetic operators, parentheses, and duration tokens.
FormatterSnapshotutilities for generating Markdown/CSV matrices reused in documentation and snapshot tests.BigDataRatefor BigInt-precise throughput conversions that interoperate withDataRate.- Built-in localized unit names now include Hindi (hi/hi_IN), Spanish (es), Portuguese (pt), Japanese (ja), Chinese (zh), Russian (ru), and English (en_IN) alongside the existing English, German, and French defaults.
- Locale-aware humanize formatting via new
ByteFormatOptions.localeanduseGroupingcontrols, powered byintl. - Shared humanize pipeline now caches
NumberFormatinstances and gracefully falls back to legacy formatting if locale data is missing. - Added regression tests covering localized output and grouping toggles for sizes and rates.
- New
byte_converter_intl.dartopt-in entry enables locale formatting without forcingintlon the default import. - Built-in localized unit-name maps (en, de, fr) plus
registerLocalizedUnitNames/clearLocalizedUnitNameshelpers for custom translations.
Notes #
- Requires the
intlpackage (already listed inpubspec.yaml). Consumers can ignorebyte_converter_intl.dartto avoid the extra dependency in their build output.
2.2.0 #
Added / Improved #
- Locale-aware parsing for sizes and rates: accepts non‑breaking spaces, underscores, and mixed decimal/group separators (comma/dot) with robust normalization.
- Stricter DataRate parsing with additional IEC/SI synonyms (e.g., KiB/s, kibps) and clear errors for unknown units.
- Internal parsing regexes hardened; number formatting remains trimmed (no trailing zeros).
Notes #
- No breaking API changes. Existing parse and humanization behavior preserved.
2.1.0 #
Added - BigInt Support #
- BigByteConverter: New class for arbitrary precision byte calculations using BigInt
- Extended unit support: Added Exabytes (EB), Zettabytes (ZB), and Yottabytes (YB) for both decimal and binary units
- BigInt extensions: Extensions for BigInt type to create BigByteConverter instances
- Exact arithmetic methods:
*Exactgetters that return BigInt values without precision loss - Cross-type conversion: Convert between ByteConverter and BigByteConverter
- Large-scale JSON serialization: Support for serializing/deserializing extremely large numbers
Use Cases for BigInt Support #
- Data center storage calculations requiring exact precision
- Scientific computing with massive datasets
- Cryptographic applications where precision is critical
- Blockchain and distributed systems with large data requirements
- Future-proofing for exascale computing scenarios
API Examples #
// Ultra-precise calculations
final dataCenter = BigByteConverter.fromExaBytes(BigInt.from(5));
final cosmic = BigByteConverter.fromYottaBytes(BigInt.one);
// BigInt extensions
final huge = BigInt.parse('999999999999999999999').bytes;
// Exact arithmetic (no precision loss)
final exact = BigInt.from(1000000000).bytes;
print(exact.gigaBytesExact); // BigInt result
print(exact.gigaBytes); // double approximation
2.0.0 #
Breaking Changes #
- Made ByteConverter class immutable
- Changed static factory methods to named constructors
- Removed deprecated methods
- Updated precision handling for integer values
Added #
- Binary unit support (KiB, MiB, GiB, TiB, PiB)
- Extension methods for fluent API
- JSON serialization support
- Math operations (+, -, *, /)
- Comparison operators
- Cached calculations for better performance
Comparableinterface implementation
Optimized #
- String formatting and caching
- Unit conversion calculations
- Memory usage with lazy initialization
- Binary search for best unit selection
- Precision handling for whole numbers
Fixed #
- Incorrect KB unit display in string output
- Precision handling for integer values
- Memory leaks from repeated calculations
- Unit conversion accuracy