countryCodeFromJson function
Implementation
enums.CountryCode countryCodeFromJson(
Object? countryCode, [
enums.CountryCode? defaultValue,
]) {
if (countryCode is String) {
return enums.$CountryCodeMap.entries
.firstWhere(
(element) =>
element.value.toLowerCase() == countryCode.toLowerCase(),
orElse: () =>
const MapEntry(enums.CountryCode.swaggerGeneratedUnknown, ''))
.key;
}
final parsedResult = defaultValue == null
? null
: enums.$CountryCodeMap.entries
.firstWhereOrNull((element) => element.value == defaultValue)
?.key;
return parsedResult ??
defaultValue ??
enums.CountryCode.swaggerGeneratedUnknown;
}