Country code to name mappings for 122 languages.
This is a port of an npm package localized-countries for Flutter.
Data is taken from https://github.com/umpirsky/country-list.
This package bundles required assets and provides custom LocalizationsDelegate for loading them.
import 'package:flutter_localized_countries/flutter_localized_countries.dart';
void main() {
runApp(MaterialApp(
localizationsDelegates: [
CountryNamesLocalizationsDelegate(),
// ... more localization delegates
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
...
);
...
print(CountryNames.of(context).nameOf('NL'));
}
- Sorting countries by name does not respect the locale, because Flutter does not provide any API for string collation.