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