Debounce class

A utility class for debouncing function calls.

The Debounce class allows you to debounce function calls, ensuring that a function is only executed after a specified delay, and resetting the timer with each call. This can be useful in scenarios where you want to delay the execution of a function until after a user has finished a series of rapid inputs, such as in search bars or input fields.

Example Usage:

// Create a debounce instance with a 500 milliseconds delay.
final debounce = Debounce(Duration(milliseconds: 500));

// Call a function and debounce its execution.
debounce(() {
  // Your function logic here.
});

// Dispose of the debounce timer when no longer needed.
debounce.dispose();

Constructors

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

Properties

delay Duration
The duration of the debounce delay.
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 callback()) → dynamic
Calls the provided callback function with debouncing.
dispose() → dynamic
Disposes of the debounce timer, preventing any further calls.
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