fDXNotificationPayloadIdTypeFromJson function

FDXNotificationPayloadIdType fDXNotificationPayloadIdTypeFromJson(
  1. Object? fDXNotificationPayloadIdType, [
  2. FDXNotificationPayloadIdType? defaultValue
])

Implementation

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

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

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