paymentScheduleIntervalFromJson function

PaymentScheduleInterval paymentScheduleIntervalFromJson(
  1. Object? paymentScheduleInterval, [
  2. PaymentScheduleInterval? defaultValue
])

Implementation

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

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

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