Debouncer class final
A practical Debouncer for optimizing performance by controlling the frequency of function calls in response to rapid events.
Constructors
-
Debouncer.new({required Duration delay, FutureOr<
void> onStart()?, FutureOr<void> onWaited()?, FutureOr<void> onCall()?})
Properties
- delay → Duration
-
The delay before calling the
_onWaited
function.final - hashCode → int
-
The hash code for this object.
no setterinherited
- onCall → _VoidCallback?
-
no setter
- onStart → _VoidCallback?
-
no setter
- onWaited → _VoidCallback?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
{FutureOr< void> onStart()?, FutureOr<void> onWaited()?, FutureOr<void> onCall()?}) → FutureOr<void> -
Calls the
onCall
function and then waits for delay before calling theonWaited
function. -
cancel(
) → bool - Cancels the debouncer.
-
finalize(
{FutureOr< void> onWaited()?}) → FutureOr<void> -
Finalizes the debouncer and calls the
onWaited
function. -
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