fDXNotificationTypeFromJson function

FDXNotificationType fDXNotificationTypeFromJson(
  1. Object? fDXNotificationType, [
  2. FDXNotificationType? defaultValue
])

Implementation

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

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

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