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