aCHClassFromJson function

ACHClass aCHClassFromJson(
  1. Object? aCHClass, [
  2. ACHClass? defaultValue
])

Implementation

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

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

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