Debounce class

A utility class for debouncing function calls.

Debouncing ensures that a function is only executed after a certain amount of time has passed since the last time it was invoked.

Example:

final debounced = Debounce(Duration(milliseconds: 300));
debounced(() => print('Called after 300ms of inactivity'));

Constructors

Debounce(Duration delay)
Creates a Debounce instance with the specified delay.

Properties

delay Duration
The duration to wait before executing the action.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(void action()) → void
Executes the action after the delay, canceling any pending execution.
cancel() → void
Cancels any pending execution.
copyWith({Duration? delay}) Debounce
Creates a copy of this Debounce with the given fields replaced.
dispose() → void
Disposes of the debounce instance and cancels any pending timers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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