AdaFormattter class
ADA-specific currency formatter that expects all curreny to be in lovelace and converts it to ADA (1 ADA = 1,000,000 lovelace). Compact formatters replace groups of zeros with quantity abbreviation suffixes (i.e. K=thousond, M=million, B=billion & T=trillion). The simple formatters group zeros into threes. Decimal digits defaults to 6 places. The currency factory method allows complete customization.
Constructors
- AdaFormattter({required NumberFormat formatter})
- AdaFormattter.compactCurrency({String? locale = 'en', String? name = ada, String? symbol = symbol, int? decimalDigits = 6})
-
A number format for compact currency representations, e.g. "₳1.2M" instead of "₳1,200,000".
factory
- AdaFormattter.compactSimpleCurrency({String? locale = 'en', String? name = ada, int? decimalDigits = 6})
-
A number format for compact currency representations, e.g. "$1.2M" instead
of "$1,200,000", and which will automatically determine a currency symbol
based on the currency name or the locale. See
NumberFormat.simpleCurrency
.factory - AdaFormattter.currency({String? locale = 'en', String? name = ada, String? symbol = symbol, int? decimalDigits = 6, String? customPattern})
-
Create a
NumberFormat
that formats using the locale's CURRENCY_PATTERN.factory - AdaFormattter.simpleCurrency({String? locale = 'en', String? name = ada, int? decimalDigits = 6})
-
Creates a
NumberFormat
for currencies, using the simple symbol for the currency if one is available (e.g. $, €), so it should only be used if the short currency symbol will be unambiguous.factory
Properties
- formatter → NumberFormat
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
format(
dynamic lovelace) → String -
Convert lovelace to ADA and format
number
according to our pattern and return the formatted string. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited