Debouncer<T> class

This class will 'debounce' a function which prevents it from being called too many times. Ideal for search bars or other situations where a call may be trigged on several rapid events.
As dart does not allow varargs or something similar, pass in a class T to be your arguments.
When run is called, it will wait (duration) before being called. If run is called again before duration is up, duration will be reset

Constructors

Debouncer({Duration duration = const Duration(milliseconds: 500), required void function(T)})

Properties

duration Duration
The time the debouncer waits before calling the function
final
function → void Function(T)
The function being called after duration
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

cancel() → void
cancel the timer, preventing function from being run
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(T param) → void
Run the given function
toString() String
A string representation of this object.
inherited

Operators

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