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