notificationTypesFromJson function

NotificationTypes notificationTypesFromJson(
  1. Object? notificationTypes
)

Implementation

enums.NotificationTypes notificationTypesFromJson(Object? notificationTypes) {
  if (notificationTypes is int) {
    return enums.$NotificationTypesMap.entries
        .firstWhere(
            (element) =>
                element.value.toLowerCase() == notificationTypes.toString(),
            orElse: () => const MapEntry(
                enums.NotificationTypes.swaggerGeneratedUnknown, ''))
        .key;
  }

  if (notificationTypes is String) {
    return enums.$NotificationTypesMap.entries
        .firstWhere(
            (element) =>
                element.value.toLowerCase() == notificationTypes.toLowerCase(),
            orElse: () => const MapEntry(
                enums.NotificationTypes.swaggerGeneratedUnknown, ''))
        .key;
  }

  return enums.NotificationTypes.swaggerGeneratedUnknown;
}