intl_country_data 1.2.6 intl_country_data: ^1.2.6 copied to clipboard
Dart package containing country data including international dialing codes and telephone number lengths. Other data include ISO 3166 2 letter country codes, flag emojis and country name translations. [...]
import 'package:intl_country_data/intl_country_data.dart';
void main() {
// Load all countries
final all = IntlCountryData.all();
print('Loaded ${all.length} countries: ${all.map((e) => e.name).join(', ')}');
// Load the UK
final country = IntlCountryData.fromCountryCodeAlpha2('GB');
print('Loaded ${country.name} ${country.flag}! '
'Also known as: ${country.nameTranslations.values.join(', ')}');
// Find matching countries for a given telephone number
final matching = IntlCountryData.fromTelephoneNumber('+447777666555');
print('Found ${matching.length} countries for this phone number: '
'${matching.map((e) => e.name).join(',')}');
}