getAllCountryDatas static method
langCode
for now the only supported code
beside the default (english) is Russian.
countryRU. If you want to translate the names of the countries
to your language, please feel free to do it and make a pull request.
Just keep the naming convention like countryBR, countryDE and so on
isForce
pass true if you need to update cache
Implementation
static List<PhoneCountryData> getAllCountryDatas({
String langCode = '',
bool isForce = false,
}) {
if (_allCountryDatas == null || isForce) {
_allCountryDatas = _data
.map((e) => e.containsKey('country${langCode.toUpperCase()}')
? PhoneCountryData.fromMap(e, lang: langCode)
: PhoneCountryData.fromMap(e))
.toList();
_allCountryDatas!.sort((a, b) => a.phoneCode!.compareTo(b.phoneCode!));
}
return _allCountryDatas!;
}