DecimalCodec class final

Converts ordinary decimal numbers to and from display strings.

Inheritance

Constructors

DecimalCodec({bool grouping = true, String groupSeparator = ',', String decimalSeparator = '.', int minFractionDigits = 0, int maxFractionDigits = 3, bool trimTrailingZeros = true, Rounding rounding = Rounding.halfUp})
Creates a codec for ordinary decimal numbers.

Properties

decimalSeparator → String
Separator used between integer and fraction digits.
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
grouping → bool
Whether integer digits are grouped.
final
groupSeparator → String
Separator inserted between grouped integer digits.
final
hashCode → int
The hash code for this object.
no setterinherited
inverted → Codec<String, num>
Inverts this.
no setterinherited
maxFractionDigits → int
Maximum number of fraction digits to keep.
final
minFractionDigits → int
Minimum number of fraction digits to keep.
final
rounding → Rounding
Rounding behavior for excess fraction digits.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
trimTrailingZeros → bool
Whether trailing zeros can be removed down to minFractionDigits.
final

Methods

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

Operators

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