getCountryByName static method

Country? getCountryByName(
  1. String? name
)

Implementation

static Country? getCountryByName(String? name) {
  try {
    return countryList.firstWhere(
      (country) => country.name.toLowerCase() == name?.toLowerCase(),
    );
  } catch (error) {
    return null;
  }
}