Fix throttler calling an action twice

There is a bug in throttler where an action is called immediately and also again when the Timer expires despite only being scheduled once by call(). This commit resets the action to null once it is completed.
This commit is contained in:
Yang Fang 2023-09-22 11:26:41 -07:00 committed by GitHub
parent 8a29d67096
commit 509487f789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ class Throttler {
void _callAction() { void _callAction() {
_action?.call(); // If we have an action queued up, complete it. _action?.call(); // If we have an action queued up, complete it.
_action = null; // Once an action is called, do not call the same action again unless another action is queued.
_timer = null; _timer = null;
} }