watchlistScreeningDocumentTypeFromJson function

WatchlistScreeningDocumentType watchlistScreeningDocumentTypeFromJson(
  1. Object? watchlistScreeningDocumentType, [
  2. WatchlistScreeningDocumentType? defaultValue
])

Implementation

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

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

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