getRegionCode method
Returns the region code for the supplied countryCode and regionName.
Implementation
String? getRegionCode(String countryCode, String regionName) {
if (_records.isEmpty) {
throw Exception('No record available.');
}
final items = _records[countryCode];
if (items == null) return null;
final region = regionName.toUpperCase();
for (final item in items) {
final regionCode = item[region];
if (regionCode != null) return regionCode;
}
return null;
}