register method

void register(
  1. Currency currency
)

Register a Currency.

Once a Currency has been registered the Currencies.parse method will be able to recognize the currencey isoCode in String and return the correct type.

Currency usd = Currency.create('USD', 2);
Currencies().register(usd);
final usdAmount = Currencies().parse(r'$USD1500.0');

See: Currencies.parse Currencies.registerList Currencies.find

Implementation

void register(Currency currency) {
  _self._directory[currency.isoCode] = currency;
}