Debouncer class

The Debouncer class is designed to limit the rate at which a function is called. It ensures that the function is only executed if a certain amount of time has passed since the last invocation of the execute method.

Constructors

Debouncer({required Duration delay, required void action()})
Constructs a Debouncer instance with the specified delay and action.

Properties

action → void Function()
The action function that will be executed after the delay.
final
delay Duration
The duration of the delay after which the action function will be called.
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

dispose() → void
Cancel the timer when the instance is disposed of. This is important to prevent any scheduled execution after the instance is considered no longer needed.
execute() → void
Call this method to trigger the debounced execution of the action.
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