Debouncer class
A utility to delay function execution until a pause in invocation occurs.
Useful for search inputs, auto-saving forms, and resize events.
final Debouncer debouncer = Debouncer(duration: const Duration(milliseconds: 300));
void onSearchChanged(String query) {
debouncer.run(() => fetchSearchResults(query));
}
Constructors
Properties
Methods
-
cancel(
) → void - Cancels the pending execution if any.
-
dispose(
) → void - Disposes the debouncer.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
void action()) → void -
Runs
actionafter duration, canceling any previously scheduled call. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited