call method
- VoidCallback action, {
- bool immediateCall = true,
Executes the provided action, adhering to the throttling interval.
If no action is currently in progress, the action will execute immediately
if immediateCall is true (default). Otherwise, the action will be executed
after the throttling interval.
Parameters
action: The action to be throttled and executed.immediateCall: Iftrue, executes the action immediately if no timer is active.
Implementation
void call(VoidCallback action, {bool immediateCall = true}) {
_action = action;
if (_timer == null) {
if (immediateCall) {
_callAction();
}
_timer = Timer(interval, _callAction);
}
}