byte_converter_full library
Full byte conversion library with all features.
This export includes everything from the main byte_converter library plus advanced features:
Statistics & Quantiles:
Streaming & Instrumentation:
StreamInstrumentation- Stream progress tracking- BandwidthAccumulator - Bandwidth monitoring
Advanced Formatting:
- FormatterSnapshot - Capture formatter state
- CompoundFormatOptions - Multi-unit formatting
FastFormat- Low-level formatting
Interoperability:
InteropAdapters- OS-specific parsing adaptersUnifiedParse- Cross-standard parsing
Localization (basic):
- Unit name registration functions
- For full i18n with intl package, use
byte_converter_intl.dart
For most use cases, the standard import is sufficient:
import 'package:byte_converter/byte_converter.dart';
Use this full export when you need advanced features:
import 'package:byte_converter/byte_converter_full.dart';
Classes
- BandwidthAccumulator
- Accumulates byte values over time for streaming scenarios.
- BigBitOperations
- Provides bit-level operations for BigByteConverter.
- BigByteConverter
- High-performance byte unit converter using BigInt for arbitrary precision.
- BigByteStats
- Statistical utilities operating on very large byte magnitudes using BigInt.
- BigDataRate
- BigInt-precision data rate stored as bits per second.
- BigHistogram
- Histogram wrapper for BigInt buckets. A histogram with BigInt BigHistogramBuckets. A histogram with BigInt BigHistogramBuckets. Histogram of BigHistogramBuckets for BigInt magnitudes.
- BigHistogramBucket
- A histogram bucket for BigInt magnitudes. A single histogram bucket for BigInt magnitudes. A single histogram bucket for BigInt magnitudes. Represents a histogram bucket for BigInt-sized magnitudes.
- BitOperations
- Provides bit-level operations and conversions for byte values.
- ByteAccessibility
- Provides accessibility-friendly output formats for byte values.
- ByteComparison
- Provides comparison and relationship utilities for byte values.
- ByteConstants
- Named constants for common byte sizes.
- ByteConverter
- High-performance byte unit converter with caching.
- ByteDelta
- Represents a signed change in bytes with arbitrary precision.
- ByteDisplayOptions
- Provides alternative display formats for byte values.
- ByteFormatOptions
- Reusable formatter options for humanizing sizes and transfer rates.
- ByteOrdinal
- Ordinal number formatting utilities.
- ByteOutputFormats
- Provides structured output formats for programmatic use.
- BytePluralization
- Smart pluralization utilities for byte-related terms.
- ByteRange
- Inclusive-exclusive byte range [start, end) backed by BigInt.
- ByteRounding
- Extended rounding strategies for byte value formatting.
- BytesMeter
- A transformer that reports byte throughput while passing data through.
- ByteStats
- Numeric aggregations over mixed byte-like inputs (double, int, BigInt, converters). Aggregations and utilities over byte magnitudes. Aggregations and utilities over byte magnitudes. Statistical utilities over collections of byte-like values.
- ByteValidation
- Input validation utilities for byte values.
- CompoundFormatOptions
- Options controlling compound mixed-unit formatting, e.g. "1 GiB 234 MiB 12 KiB".
- DataRate
- Represents a network/data rate. Internally stored as bits per second.
- FormatterSnapshot
- Utility for generating snapshot matrices of formatted byte sizes or data rates.
- Histogram
- Histogram of HistogramBuckets for double-based magnitudes.
- HistogramBucket
- Represents a histogram bucket for double-based magnitudes with an optional inclusive upperBound and associated count.
- NaturalTimeDelta
- Human-friendly time descriptions for durations.
- NegativeByteFormatter
- Utilities for formatting negative byte values.
- NegativeValueOptions
- Configuration for negative value formatting.
- NetworkRate
- Network rate utilities providing bits/bytes per second conversions and transfer time calculations.
- OSParsingModes
- Adapters to parse sizes from common external libraries/outputs.
- ParsedBig
- Parsed result carrying a BigByteConverter for very large magnitudes. Large parsed result backed by a BigByteConverter.
- ParsedByteSize
- Abstract view over an auto-parsed byte size, which may be backed by a regular-precision or BigInt-precision implementation depending on size.
- ParsedNormal
- Normal-sized parsed result backed by a ByteConverter.
- ParseError
- Structured error information produced by parse helpers.
-
ParseResult<
T> - Result wrapper for non-throwing parse helpers.
- PluralizationOptions
- Configuration for pluralization behavior.
- RateWindow
- Represents a window of rate over a time span, for planning variable schedules.
- RelativeTime
- Relative time formatting utilities.
- RelativeTimeOptions
- Configuration options for relative time formatting.
- SINumber
- SI (International System of Units) number formatting utilities.
- SizeDelta
- Represents a change in byte size with direction awareness.
- StorageAlignment
- Describes a single alignment class within a StorageProfile.
- StorageNamespace
- Storage alignment utilities providing sector, block, page, and word calculations along with rounding and alignment checks.
- StorageProfile
- Defines storage alignment preferences used by byte converters when rounding to device-specific bucket sizes such as sectors, blocks, or pages.
- StreamingQuantiles
- Streaming quantile estimator interface with factory constructors for P² (default) and TDigest implementations.
- StreamProgress
- Snapshot of a transfer stream's progress.
- TDigest
- Lightweight t-digest implementation for streaming quantile estimation.
- TransferPlan
- Simple transfer planning model for estimating ETAs and progress.
- ValidationResult
- Result of a validation operation.
Enums
- BigSizeUnit
- Size units for BigByteConverter with support for larger SI magnitudes.
- ByteRoundingMode
- Rounding mode enumeration for byte formatting.
- ByteStandard
- Unit standards/prefix systems used for formatting and parsing.
- DeltaDirection
- Modes for byte delta direction.
- NegativeDisplayMode
- Modes for displaying negative byte values.
- PluralizationRule
- Pluralization rules for different locales.
- RoundingMode
- Rounding modes for converting fractional values to integers.
- SizeUnit
- Byte size units for standard precision conversions (up to PB).
Extensions
- BigBitOperationsExtension on BigByteConverter
- Extension providing bit operations accessor for BigByteConverter.
- BigByteConverterNamespaces on BigByteConverter
- Extension providing namespace accessors for BigByteConverter.
- BigDataRatePlanning on BigDataRate
- Planning helpers for computing transferable bytes over a duration at a given BigDataRate. Methods avoid rounding drift by using integer math.
- BigIntByteConverterExtension on BigInt
- Extensions for BigInt to create BigByteConverter instances.
- BitOperationsExtension on ByteConverter
- Extension providing bit operations accessor for ByteConverter.
- ByteConverterNamespaces on ByteConverter
- Extension providing namespace accessors for ByteConverter.
- ByteConverterTransfer on ByteConverter
- ByteConverter helpers for transfer planning.
- ByteRoundingExtension on double
- Provides convenience methods for rounding byte values.
- ByteValidationExtension on ByteConverter
- Extension to add validation methods to ByteConverter.
- DataRatePlanning on DataRate
- DataRate helpers for planning.
- DoubleByteConverterExtension on double
- Extensions for double to create ByteConverter instances.
- DoublePluralizationExtension on double
- Extension on double for quick pluralization.
- IntByteConverterExtension on int
- Extensions for int to create ByteConverter instances.
- IntPluralizationExtension on int
- Extension on int for quick pluralization.
- NaturalTimeDeltaExtension on Duration
- Extension to add natural time formatting to Duration.
- NegativeBigByteConverterExtension on BigByteConverter
- Extension on BigByteConverter for negative value support.
- NegativeByteConverterExtension on ByteConverter
- Extension on ByteConverter for negative value support.
- NegativeBytesDoubleExtension on double
- Extension on double for negative byte formatting.
- OrdinalExtension on int
- Extension for ordinal formatting on integers.
- RelativeDateTimeExtension on DateTime
- Extension on DateTime for relative time formatting.
- RelativeDurationExtension on Duration
- Extension on Duration for relative time formatting.
- SINumberExtension on num
- Extension for SI number formatting on num types.
- TransferPlanAdvanced on TransferPlan
- Advanced controls: schedules, pause/resume, and throttling.
Functions
-
clearLocalizedSingularNames(
String locale) → void -
Clears previously registered localized singular-name overrides for
locale. -
clearLocalizedSynonyms(
String locale) → void -
Clears previously registered localized synonyms for
locale. -
clearLocalizedUnitNames(
String locale) → void -
Clears previously registered localized unit names for
locale. -
disableDefaultLocalizedUnitNames(
) → void - Disable built-in default localized unit names to enable tree-shaking strategies. Disables the built-in default localized unit names to aid tree-shaking.
-
enableDefaultLocalizedUnitNames(
) → void - Re-enable built-in default localized unit names. Re-enables the built-in default localized unit names.
-
fastHumanizeIecBytes(
double bytes, {int precision = 2}) → String - Ultra-fast formatter for simple IEC bytes use-cases. Units: B, KiB, MiB, GiB, TiB, PiB.
-
fastHumanizeSiBits(
double bytes, {int precision = 2}) → String - Ultra-fast formatter for SI bits.
-
fastHumanizeSiBytes(
double bytes, {int precision = 2}) → String - Ultra-fast formatter for simple SI bytes use-cases.
-
formatCompound(
double bytes, CompoundFormatOptions opt) → String - Formats a byte quantity (in bytes) to a compound mixed-unit string.
-
localizedUnitName(
String symbol, {String? locale}) → String? -
Returns a localized full name for a canonical unit
symbolfor the givenlocale(base-locale fallback). Returns null when no mapping is found. -
localizedUnitSingularName(
String symbol, {String? locale, bool bits = false}) → String? -
Returns a singular name for the given unit symbol if available for the locale.
Falls back to plural name when no singular registered.
Returns the singular form for a unit
symbolinlocalewhen available. Falls back to plural when no singular is registered. -
parseByteSizeAuto(
String input, {ByteStandard standard = ByteStandard.si, RoundingMode rounding = RoundingMode.round, double thresholdBytes = 9.22e18}) → ParsedByteSize -
Parses
inputand returns either ByteConverter or BigByteConverter depending onthresholdBytes. Useful when inputs may exceed 64-bit range. Values >=thresholdBytesare parsed and returned as ParsedBig. -
parseLocalized(
String input, {String? locale, ByteStandard standard = ByteStandard.si}) → ParseResult< ByteConverter> - Parses a size string using locale-aware unit words and number formats when available. Uses resolveLocalizedUnitSymbol and number normalization to reconstruct a canonical parse input before delegating to the core parser.
-
registerLocalizedSingularNames(
String locale, Map< String, String> singular) → void -
Register singular forms for full-form names per locale (optional).
keys must be canonical plural names from localizedUnitName (e.g., 'kilobytes'), values singular (e.g., 'kilobyte').
Registers singular forms for full-form names per
locale. Keys must be canonical plural names returned by localizedUnitName (e.g., 'kilobytes'). -
registerLocalizedSynonyms(
String locale, Map< String, String> synonyms) → void -
Register per-locale synonyms that map localized words back to canonical symbols.
Example (fr): { 'octet': 'B', 'octets': 'B', 'kilooctets': 'KB', 'ko': 'KB' }
Registers per-
localesynonyms mapping localized words back to canonical symbols, used during parsing (e.g., 'octets' -> 'B'). Keys are matched case-insensitively. -
registerLocalizedUnitNames(
String locale, Map< String, String> names) → void -
Registers custom localized full names for a
locale. Keys must be canonical symbols (e.g.,KB,MiB,kb). -
resolveLocalizedUnitSymbol(
String token, {String? locale}) → String? -
Resolve a localized token (possibly a full word or synonym) back to a canonical unit symbol.
This is used by parseLocalized helpers. Returns null if no mapping is found.
Resolves a localized
token(full word or synonym) back to a canonical unit symbol. Returns null if no mapping is found. -
trackBytes(
Stream< List< source, {ProgressCallback? onProgress, Duration sample = const Duration(seconds: 1), ByteConverter? total, bool emitImmediate = true}) → Stream<int> >List< int> > - Wraps a byte stream and periodically reports throughput statistics.
Typedefs
- ProgressCallback = void Function(StreamProgress)
- Callback for reporting stream progress samples.