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