CompactCodec class final
Converts compact values such as 1.2K or 3.4M.
Constructors
-
CompactCodec({required NumeralUnitSet unitSet, NumeralCodec<
num> ? style, String decimalSeparator = '.', int minFractionDigits = 0, int maxFractionDigits = 2, bool trimTrailingZeros = true, Rounding rounding = Rounding.halfUp, bool compactOverflow = true}) - Creates a compact number codec.
Properties
- compactOverflow → bool
-
Whether rounded values can move to the next larger unit.
final
-
decoder
→ Converter<
String, num> -
Converts display strings into numeric values.
no setterinherited
-
encoder
→ Converter<
num, String> -
Converts numeric values into display strings.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inverted
→ Codec<
String, num> -
Inverts
this.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
style
→ NumeralCodec<
num> -
Codec used for the numeric part before the compact unit.
final
- unitSet → NumeralUnitSet
-
Unit set used by this codec.
final
Methods
-
decode(
String encoded) → num -
Alias for parse.
inherited
-
encode(
num input) → String -
Alias for format.
inherited
-
format(
num value) → String -
Formats
valueinto a display string.override -
fuse<
R> (Codec< String, R> other) → Codec<num, R> -
Fuses
thiswithother.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
String input) → num -
Parses
inputand returns the numeric value.override -
toString(
) → String -
A string representation of this object.
inherited
-
tryParse(
String input) → num? -
Parses
input, returningnullinstead of throwing FormatException.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited