HierarchySearchController<R> class
Pure Dart controller for hierarchy search list navigation.
Manages search results and keyboard-style list selection without
any Flutter dependency. Widgets call controller methods, then
refresh their own UI (e.g. setState).
Generic over the result type R — typically SignalSearchResult
or OccurrenceSearchResult.
// In a Flutter widget:
final controller = HierarchySearchController.forSignals(hierarchy);
void _onSearchChanged() {
controller.updateQuery(_textController.text);
setState(() {});
}
Constructors
-
HierarchySearchController({required List<
R> searchFn(String normalizedQuery), required String normalizeFn(String rawQuery)}) - Create a controller with custom search and normalise functions.
- HierarchySearchController.forOccurrences(HierarchyService hierarchy)
-
Create a controller for occurrence search on the given
HierarchyService.
factory
- HierarchySearchController.forSignals(HierarchyService hierarchy)
-
Create a controller for signal search on the given
HierarchyService.
factory
Properties
- counterText → String
-
A human-readable counter string, e.g.
"3/12", or empty when there are no results.no setter - currentSelection → R?
-
The currently selected result, or
nullif the list is empty.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasResults → bool
-
Whether there are any results.
no setter
-
results
→ List<
R> -
The current search results.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedIndex → int
-
Index of the currently highlighted result.
no setter
Methods
-
clear(
) → void - Clear all results and reset the selection index.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
selectAt(
int index) → void -
Move selection to a specific
index. -
selectNext(
) → void - Move selection to the next result, wrapping around.
-
selectPrevious(
) → void - Move selection to the previous result, wrapping around.
-
tabComplete(
String currentQuery, {String displayPath(R result)?}) → String? -
Compute the tab-completion expansion for
currentQuery. -
toString(
) → String -
A string representation of this object.
inherited
-
updateQuery(
String rawQuery) → void -
Update search results for
rawQuery.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited