loadCountries method
Future<void>
loadCountries({
- required Map<
String, CountryWithPhoneCode> phoneCodesMap, - Map<
String, CountryWithPhoneCode> overrides = const {},
Implementation
Future<void> loadCountries({
required final Map<String, CountryWithPhoneCode> phoneCodesMap,
final Map<String, CountryWithPhoneCode> overrides = const {},
}) async {
if (_initialized) {
return;
}
try {
/// Apply any overrides to masks / country data
overrides.forEach((final key, final value) {
phoneCodesMap[key] = value;
// print('Applied override for $key');
});
/// Save list of the countries
_countries = phoneCodesMap.values.toList();
_initialized = true;
} catch (err) {
_countries = overrides.values.toList();
// log('[CountryManager] Error loading countries: $err');
}
}