Throttler class

A small utility to throttle function execution.

Constructors

Throttler({int? milliseconds, Duration? duration, bool trailing = false})
Creates a throttler with the provided milliseconds or duration window.
Throttler.duration(Duration duration, {bool trailing = false})
Creates a throttler with the provided duration window.
factory

Properties

duration → Duration
Throttle delay duration.
final
hashCode → int
The hash code for this object.
no setterinherited
hasPendingAction → bool
Whether a trailing action is waiting for the window to close.
no setter
isActive → bool
Whether a throttle cooldown window is currently active.
no setter
milliseconds → int
Throttle delay in milliseconds.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
trailing → bool
Whether the last suppressed action runs when the window closes.
final

Methods

cancel() → void
Alias for dispose.
dispose() → void
Cancels the active throttle window and discards any trailing action.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(void action()) → void
Runs action immediately if not currently throttled.
toString() → String
A string representation of this object.
inherited

Operators

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