SearchController constructor Null safety

SearchController(
  1. String index,
  2. String url,
  3. String credentials,
  4. String id,
  5. {AppbaseSettings? appbaseConfig,
  6. TransformRequest? transformRequest,
  7. TransformResponse? transformResponse,
  8. Map<String, String>? headers,
  9. QueryType? type,
  10. Map<String, dynamic>? react,
  11. String? queryFormat,
  12. dynamic dataField,
  13. String? categoryField,
  14. String? categoryValue,
  15. String? nestedField,
  16. int? from,
  17. int? size,
  18. SortType? sortBy,
  19. String? aggregationField,
  20. int? aggregationSize,
  21. Map? after,
  22. bool? includeNullValues,
  23. List<String>? includeFields,
  24. List<String>? excludeFields,
  25. dynamic fuzziness,
  26. bool? searchOperators,
  27. bool? highlight,
  28. dynamic highlightField,
  29. Map? customHighlight,
  30. int? interval,
  31. List<String>? aggregations,
  32. String? missingLabel,
  33. bool? showMissing,
  34. bool? enableSynonyms,
  35. String? selectAllLabel,
  36. bool? pagination,
  37. bool? queryString,
  38. Map defaultQuery(
    1. SearchController searchController
    )?,
  39. Map customQuery(
    1. SearchController searchController
    )?,
  40. Future beforeValueChange(
    1. dynamic value
    )?,
  41. void onValueChange(
    1. String? next,
    2. {String? prev}
    )?,
  42. void onResults(
    1. List<Map>? next,
    2. {List<Map>? prev}
    )?,
  43. void onAggregationData(
    1. List<Map>? next,
    2. {List<Map>? prev}
    )?,
  44. void onError(
    1. dynamic error
    )?,
  45. void onRequestStatusChange(
    1. String? next,
    2. {String? prev}
    )?,
  46. void onQueryChange(
    1. Map? next,
    2. {Map? prev}
    )?,
  47. bool? enablePopularSuggestions,
  48. int? maxPopularSuggestions,
  49. bool? showDistinctSuggestions,
  50. bool? preserveResults,
  51. String? distinctField,
  52. Map? distinctFieldConfig,
  53. dynamic value,
  54. bool clearOnQueryChange = false,
  55. List<Map>? results}
)

Implementation

SearchController(
  String index,
  String url,
  String credentials,
  String this.id, {
  AppbaseSettings? appbaseConfig,
  TransformRequest? transformRequest,
  TransformResponse? transformResponse,
  Map<String, String>? headers,
  this.type,
  this.react,
  this.queryFormat,
  this.dataField,
  this.categoryField,
  this.categoryValue,
  this.nestedField,
  this.from,
  this.size,
  this.sortBy,
  this.aggregationField,
  this.aggregationSize,
  this.after,
  this.includeNullValues,
  this.includeFields,
  this.excludeFields,
  this.fuzziness,
  this.searchOperators,
  this.highlight,
  this.highlightField,
  this.customHighlight,
  this.interval,
  this.aggregations,
  this.missingLabel,
  this.showMissing,
  this.enableSynonyms,
  this.selectAllLabel,
  this.pagination,
  this.queryString,
  this.defaultQuery,
  this.customQuery,
  this.beforeValueChange,
  this.onValueChange,
  this.onResults,
  this.onAggregationData,
  this.onError,
  this.onRequestStatusChange,
  this.onQueryChange,
  // this.onMicStatusChange,
  this.enablePopularSuggestions,
  this.maxPopularSuggestions,
  this.showDistinctSuggestions,
  this.preserveResults,
  this.distinctField,
  this.distinctFieldConfig,
  this.value,
  this.clearOnQueryChange = false,
  List<Map>? results,
}) : super(index, url, credentials,
          appbaseConfig: appbaseConfig,
          transformRequest: transformRequest,
          transformResponse: transformResponse,
          headers: headers) {
  if (id == "") {
    throw (ErrorMessages[InvalidComponentId]);
  }
  // dataField can't be an array for queries other than search
  if (type != null && type != QueryType.search && dataField is List<String>) {
    throw (ErrorMessages[DataFieldAsArray]);
  }
  // Initialize the state changes observable
  this.stateChanges = new Observable();

  this.results = new Results(
      results != null ? results as List<Map<String, dynamic>> : []);

  this.aggregationData = new Aggregations(data: []);

  if (value != null) {
    this.setValue(value, options: new Options());
  } else {
    this.value = value;
  }
}