Throttle class

Throttle utility to limit function call frequency

Example:

final throttled = Throttle(Duration(milliseconds: 100));
throttled(() => print('Called at most once per 100ms'));
final newThrottled = throttled.copyWith(delay: Duration(milliseconds: 200));

Constructors

Throttle(Duration delay)

Properties

delay 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

call(void action()) → void
Executes the function immediately if not throttled, otherwise waits
cancel() → void
Cancels any pending throttle
copyWith({Duration? delay}) Throttle
Creates a copy of this Throttle with the given fields replaced
dispose() → void
Disposes the throttle instance
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