getCountryByCurrencyCode static method

Country getCountryByCurrencyCode(
  1. String currencyCode
)

Implementation

static Country getCountryByCurrencyCode(String currencyCode) {
  try {
    return countryList.firstWhere(
      (country) =>
          country.currencyCode!.toLowerCase() == currencyCode.toLowerCase(),
    );
  } catch (error) {
    throw Exception(
        "The initialValue provided is not a supported currency code!");
  }
}