ElasticAutocompleteController<T extends String> class

A controller for an ElasticAutocomplete, which controls the list of options.

Constructors

ElasticAutocompleteController({required String id, bool useLocalStorage = true, bool caseSensitive = false, bool latestFirst = true, List<T>? initialOptions, int showTopKWhenInputEmpty = 0, bool contains(T candidate, String userInput)?})
You can set contains in order to decide which options should be chosen. from the memory unit. Your custom contains function will be used in optionsBuilder. If you set contains, then caseSensitive is neglected.

Properties

caseSensitive bool
Decide optionsBuilder to be case sensitive or not.
final
contains bool Function(T candidate, String userInput)?
Returns true to add candidate to the option list
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id String
id is used to distinguish different memory units.
final
initialOptions List<T>?
Pass the initial options.
final
latestFirst bool
If true, the new value is considered first.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showTopKWhenInputEmpty int
Show at most how many options even if the users input nothing.
final
useLocalStorage bool
With localStorage, the data is persisted until the user manually clears cache.
final

Methods

clear() → void
Clear all options in the storage unit.
fieldViewBuilder({Key? key, InputDecoration? decoration = const InputDecoration(), TextInputType? keyboardType, TextCapitalization textCapitalization = TextCapitalization.none, TextInputAction? textInputAction, TextStyle? style, StrutStyle? strutStyle, TextDirection? textDirection, TextAlign textAlign = TextAlign.start, TextAlignVertical? textAlignVertical, bool autofocus = false, bool readOnly = false, bool? showCursor, String obscuringCharacter = '•', bool obscureText = false, bool autocorrect = true, SmartDashesType? smartDashesType, SmartQuotesType? smartQuotesType, bool enableSuggestions = true, MaxLengthEnforcement? maxLengthEnforcement, int? maxLines = 1, int? minLines, bool expands = false, int? maxLength, ValueChanged<String>? onChanged, GestureTapCallback? onTap, VoidCallback? onEditingComplete, void onFieldSubmitted(String)?, FormFieldSetter<String>? onSaved, FormFieldValidator<String>? validator, List<TextInputFormatter>? inputFormatters, bool? enabled, double cursorWidth = 2.0, double? cursorHeight, Radius? cursorRadius, Color? cursorColor, Brightness? keyboardAppearance, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), bool? enableInteractiveSelection, TextSelectionControls? selectionControls, InputCounterWidgetBuilder? buildCounter, ScrollPhysics? scrollPhysics, Iterable<String>? autofillHints, AutovalidateMode? autovalidateMode, ScrollController? scrollController, String? restorationId, bool enableIMEPersonalizedLearning = true, MouseCursor? mouseCursor}) AutocompleteFieldViewBuilder
load() List<T>
Load options from the storage unit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optionsBuilder(TextEditingValue textEditingValue) Iterable<T>
store(T val) Future
Store val to the storage unit.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

sessionStorage Map<String, List>
getter/setter pair