DeBouncer class final

de-bounces run method calls and runs it only once in given duration. It will ignore any calls to run until duration has passed since the last call to run. It can be used to de-bounce any method calls like search, filter, etc.

Constructors

DeBouncer([Duration? duration])
Allows to create an instance with optional Duration with immediateFirstRun set to false. See immediateFirstRun for more details.
DeBouncer.immediate([Duration? duration])
Allows to create an instance with optional Duration with immediateFirstRun set to true. See immediateFirstRun for more details.

Properties

duration Duration
de-bounce period. Default is 300 milliseconds. It will ignore any calls to run until duration has passed since the last call to run.
final
hashCode int
The hash code for this object.
no setterinherited
immediateFirstRun bool
Allows to run the first call immediately. Default is false. If set to true, the first call to run will be executed immediately calling the action and then it will wait for duration to run the next call if there's any.
final
isRunning bool
Returns true if timer is running and a call is scheduled to run in future else returns false.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call<R>(DeBounceAction<R> action) Future<R>
alias for run. This also makes it so that you can use the instance as a function.
cancel() → void
Allows to cancel current timer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run<R>(DeBounceAction<R> action, {bool? immediateFirstRun}) Future<R>
Runs action after debounced interval. If immediateFirstRun is set to true, it will run the action immediately for the first call and then it will wait for duration to run the next call if there's any.
toString() String
A string representation of this object.
inherited

Operators

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