toCurrency method

Currency toCurrency()

Converts this string into the corresponding Currency value.

Implementation

Currency toCurrency() {
  for (final Currency currency in Currency.values) {
    if (toUpperCase() == currency.alphabetic || this == currency.numerical)
      return currency;
  }

  throw const FormatException(
      'The string does not contains a valid (or unique) Currency'
      ' representation.');
}