Throttler class
Throttle a function: at most one call per duration window.
final clickGuard = Throttler(duration: Duration(seconds: 1));
ElevatedButton(onPressed: () => clickGuard.run(() => submit()));
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Reset the throttle clock so the next run is immediate.
-
run(
void fn()) → bool -
Run
fnif enough time has passed since the last allowed call. Returns whether the call was executed. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited