Debouncer class
Usage Example:
bool _didPrint = false;
final _debouncer = Debouncer(
const Duration(seconds: 1),
onWaited: () {
print('Hello World!');
bool _didPrint = true;
}
);
// ...
this._debouncer((){
bool _didPrint = false;
});
Constructors
Properties
- delay → Duration
-
The delay before calling the onWaited function.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onCall
→ (FutureOr<
void> Function()?) -
The function to call immediately.
final
-
onWaited
→ (FutureOr<
void> Function()?) -
The function to call after the delay has passed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
{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