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