Currencies class

A factory for registering, parsing and finding Currency instances.

Money2 registers a default set ofCommonCurrencies with the Currencies class. This allows you to use the Currencies.parse method to parse a Money amount with a currency isoCode.

You can add additional Currency or replace existing Currencys by calling Currencies.register.

You don't need to register Currencys, you can just create Currencys and use them as needed.

see: Currency CommonCurrencies

Constructors

Currencies()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

find(String isoCode) Currency?
Searches the list of registered Currencys.
findByCode(String monetaryAmount) Currency?
Searches for the matching registered Currency by comparing the currency codes in a monetaryAmount.
getRegistered() Iterable<Currency>
Returns all currently registered Currencys
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String monetaryAmountWithIsoCode, {String? pattern}) Money
Parses a string containing a money amount including a currency isoCode.
register(Currency currency) → void
Register a Currency.
registerList(Iterable<Currency> currencies) → void
Register a list of currencies.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String isoCode) Currency?
Short hand method to find a currency based on its isoCode. Throw UnknownCurrencyException if the isoCode hasn't been registered and is not one of the CommonCurrencies.
operator []=(String isoCode, Currency currency) → void
Short hand method to register a Currency.