fromCode static method

CurrencyFormat? fromCode(
  1. String code, [
  2. List<CurrencyFormat> currencies = CurrencyFormatter.majorsList
])

Get the CurrencyFormat of a currency using its abbreviation.

Implementation

static CurrencyFormat? fromCode(
  String code, [
  List<CurrencyFormat> currencies = CurrencyFormatter.majorsList,
]) {
  if (currencies.any((c) => c.code?.toLowerCase() == code.toLowerCase())) {
    return currencies
        .firstWhere((c) => c.code?.toLowerCase() == code.toLowerCase());
  }
  return null;
}