fromName static method
Gets CountryCode based on the given country name.
Returns null
if not found.
Implementation
static CountryCode? fromName(String? name) {
if (name == null) return null;
final allCountryCodes = codes.map(CountryCode.fromMap).toList();
final index = allCountryCodes
.indexWhere((c) => c.name.toLowerCase() == name.toLowerCase());
if (index == -1) return null;
return allCountryCodes[index];
}