BytesCodec class final

Converts byte counts to and from byte size strings.

Inheritance

Constructors

BytesCodec({NumeralUnitSet unitSet = decimalByteUnits, bool? spaceBeforeUnit, NumeralCodec<num>? style, String decimalSeparator = '.', int minFractionDigits = 0, int maxFractionDigits = 2, bool trimTrailingZeros = true, Rounding rounding = Rounding.halfUp})
Creates a decimal byte codec using powers of 1000.
BytesCodec.binary({bool spaceBeforeUnit = true, NumeralCodec<num>? style, String decimalSeparator = '.', int minFractionDigits = 0, int maxFractionDigits = 2, bool trimTrailingZeros = true, Rounding rounding = Rounding.halfUp})
Creates a binary byte codec using powers of 1024.

Properties

decoder → Converter<String, int>
Converts display strings into numeric values.
no setterinherited
encoder → Converter<int, String>
Converts numeric values into display strings.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
inverted → Codec<String, int>
Inverts this.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spaceBeforeUnit → bool?
Whether a space is inserted before the unit symbol.
final
style → NumeralCodec<num>
Codec used for the numeric part before the byte unit.
final
unitSet → NumeralUnitSet
Byte unit set used by this codec.
final

Methods

decode(String encoded) → int
Alias for parse.
inherited
encode(int input) → String
Alias for format.
inherited
format(num value) → String
Formats value into a display string.
override
fuse<R>(Codec<String, R> other) → Codec<int, R>
Fuses this with other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String input) → int
Parses input and returns the numeric value.
override
toString() → String
A string representation of this object.
inherited
tryParse(String input) → int?
Parses input, returning null instead of throwing FormatException.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited