CurrencyCodec class final

Converts display-oriented currency values.

Inheritance

Constructors

CurrencyCodec(String symbol, {bool symbolOnRight = false, bool spaceBetweenSymbolAndNumber = false, NumeralCodec<num>? style, bool grouping = true, String groupSeparator = ',', String decimalSeparator = '.', int minFractionDigits = 2, int maxFractionDigits = 2, bool trimTrailingZeros = false, Rounding rounding = Rounding.halfUp})
Creates a currency codec.

Properties

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
spaceBetweenSymbolAndNumber bool
Whether a space is inserted between symbol and number.
final
style NumeralCodec<num>
Codec used for the numeric part inside the currency string.
final
symbol String
Currency symbol.
final
symbolOnRight bool
Whether symbol appears after the number.
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