RawAutocomplete<T extends Object> constructor
Null safety
- {Key? key,
- required AutocompleteOptionsViewBuilder<
T> optionsViewBuilder, - required AutocompleteOptionsBuilder<
T> optionsBuilder, - AutocompleteOptionToString<
T> displayStringForOption = defaultStringForOption, - AutocompleteFieldViewBuilder? fieldViewBuilder,
- FocusNode? focusNode,
- AutocompleteOnSelected<
T> ? onSelected, - TextEditingController? textEditingController,
- 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.',
);