alpha2Code static method
Returns the ISO 3166-1 alpha2Code
for the given locale
.
If not provided, device's locale will be used instead.
You can read more about ISO 3166-1 codes here
Example: (US
, PT
, etc.)
Implementation
static String? alpha2Code([Locale? locale]) {
String? code = _resolveLocale(locale);
return CountryDetails.fromMap(codes[code!], _localizedCountryNames[code])
.alpha2Code;
}