paymentAmountCurrencyFromJson function

PaymentAmountCurrency paymentAmountCurrencyFromJson(
  1. Object? paymentAmountCurrency, [
  2. PaymentAmountCurrency? defaultValue
])

Implementation

enums.PaymentAmountCurrency paymentAmountCurrencyFromJson(
  Object? paymentAmountCurrency, [
  enums.PaymentAmountCurrency? defaultValue,
]) {
  if (paymentAmountCurrency is String) {
    return enums.$PaymentAmountCurrencyMap.entries
        .firstWhere(
            (element) =>
                element.value.toLowerCase() ==
                paymentAmountCurrency.toLowerCase(),
            orElse: () => const MapEntry(
                enums.PaymentAmountCurrency.swaggerGeneratedUnknown, ''))
        .key;
  }

  final parsedResult = defaultValue == null
      ? null
      : enums.$PaymentAmountCurrencyMap.entries
          .firstWhereOrNull((element) => element.value == defaultValue)
          ?.key;

  return parsedResult ??
      defaultValue ??
      enums.PaymentAmountCurrency.swaggerGeneratedUnknown;
}