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