getCountry function
Retrieves country-specific information based on the provided Country enumeration.
This function takes a Country
enumeration as input and retrieves country-specific
information as a Map<String, String>
from the supportedCountries
map. The map
contains key-value pairs with country names as keys and corresponding information
as values. The function uses a switch statement to match the input Country
and
returns the corresponding map entry from the supportedCountries
map. If no match
is found, the function returns the map entry for the default country 'USA'.
@param country The Country enumeration for which to retrieve country-specific information.
@return A Map<String, String>
containing country-specific information, or null if not found.
Implementation
Map<String, String>? getCountry(Country country) {
switch (country) {
case Country.KENYA:
return supportedCountries['kenya'];
case Country.UGANDA:
return supportedCountries['uganda'];
case Country.TANZANIA:
return supportedCountries['tanzania'];
case Country.BELGIUM:
return supportedCountries['belgium'];
case Country.UK:
return supportedCountries['uk'];
case Country.NIGERIA:
return supportedCountries['nigeria'];
default:
return supportedCountries['usa'];
}
}