fDXNotificationCategoryFromJson function

FDXNotificationCategory fDXNotificationCategoryFromJson(
  1. Object? fDXNotificationCategory, [
  2. FDXNotificationCategory? defaultValue
])

Implementation

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

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

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