RawAutocomplete<T extends Object> constructor Null safety

const RawAutocomplete<T extends Object>(
  1. {Key? key,
  2. required AutocompleteOptionsViewBuilder<T> optionsViewBuilder,
  3. required AutocompleteOptionsBuilder<T> optionsBuilder,
  4. AutocompleteOptionToString<T> displayStringForOption = defaultStringForOption,
  5. AutocompleteFieldViewBuilder? fieldViewBuilder,
  6. FocusNode? focusNode,
  7. AutocompleteOnSelected<T>? onSelected,
  8. TextEditingController? textEditingController,
  9. TextEditingValue? initialValue}
)

Create an instance of RawAutocomplete.

displayStringForOption, optionsBuilder and optionsViewBuilder must not be null.

Implementation

const RawAutocomplete({
  super.key,
  required this.optionsViewBuilder,
  required this.optionsBuilder,
  this.displayStringForOption = defaultStringForOption,
  this.fieldViewBuilder,
  this.focusNode,
  this.onSelected,
  this.textEditingController,
  this.initialValue,
}) : assert(displayStringForOption != null),
     assert(
       fieldViewBuilder != null
          || (key != null && focusNode != null && textEditingController != null),
       'Pass in a fieldViewBuilder, or otherwise create a separate field and pass in the FocusNode, TextEditingController, and a key. Use the key with RawAutocomplete.onFieldSubmitted.',
      ),
     assert(optionsBuilder != null),
     assert(optionsViewBuilder != null),
     assert((focusNode == null) == (textEditingController == null)),
     assert(
       !(textEditingController != null && initialValue != null),
       'textEditingController and initialValue cannot be simultaneously defined.',
     );