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