UThrottler class
Runs at most once per interval, e.g. a button that must not fire twice. final UThrottler t = UThrottler(interval: 1.seconds); t.run(pay);
Constructors
- UThrottler({required Duration interval, bool trailing = false})
-
Makes a throttler that allows one call per
interval;trailingalso runs the last skipped call at the end.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- interval → Duration
-
Minimum time between two runs.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- trailing → bool
-
When true, the last call made during the wait also runs once the wait ends.
final
Methods
-
cancel(
) → void - Forgets the last run and drops any queued call.
-
dispose(
) → void - Same as cancel(); call it in your State.dispose().
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
void action()) → void -
Runs
actionnow if allowed, otherwise skips it (or queues it when trailing).throttler.run(save) -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited