AutoSuggestController<T> class

Controller for managing AutoSuggestBox state and business logic

This controller handles:

  • Search query debouncing to reduce API calls
  • Loading and error states
  • Overlay visibility management
  • Recent searches tracking
  • Search history management
Inheritance

Constructors

AutoSuggestController({Duration debounceDelay = const Duration(seconds: 1), int minSearchLength = 2, int maxRecentSearches = 10, bool enableRecentSearches = false})

Properties

debounceDelay Duration
final
enableRecentSearches bool
final
failedSearches int
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isLoading bool
no setter
isOverlayVisible bool
no setter
lastError Object?
no setter
lastSearchLoaded String
no setter
maxRecentSearches int
final
minSearchLength int
final
recentSearches List<String>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchQuery String
no setter
searchSuccessRate double
Get search success rate (0.0 to 1.0)
no setter
successfulSearches int
no setter
totalSearches int
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addRecentSearch(String query) → void
Manually add a search to recent searches
clearError() → void
Clear error
clearRecentSearches() → void
Clear recent searches
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
getStats() Map<String, dynamic>
Get controller statistics
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeRecentSearch(String query) → void
Remove a specific recent search
reset() → void
Reset controller state
resetMetrics() → void
Reset search metrics
setError(Object? error) → void
Set error
setLoading(bool loading) → void
Set loading state
setOverlayVisible(bool visible) → void
Set overlay visibility
shouldSearch(String query) bool
Check if a query should trigger a search
toString() String
A string representation of this object.
inherited
updateLastSearchLoaded(String search) → void
Update last search loaded
updateSearchQuery(String query, {required VoidCallback onDebounceComplete}) → void
Update search query with debouncing

Operators

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