getCountryByIsoCode static method

Country? getCountryByIsoCode(
  1. String? isoCode
)

Implementation

static Country? getCountryByIsoCode(String? isoCode) {
  try {
    if (isoCode?.isEmpty != false) {
      return null;
    }
    return countryList.firstWhere(
          (country) => country.isoCode.toLowerCase() == isoCode?.toLowerCase(),
    );
  } catch (error) {
    return null;
  }
}