warningWarningCodeFromJson function

WarningWarningCode warningWarningCodeFromJson(
  1. Object? warningWarningCode, [
  2. WarningWarningCode? defaultValue
])

Implementation

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

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

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