throttle function
void
throttle(
- String id,
- VoidCallback runner, {
- bool leaky = false,
- Duration cooldown = const Duration(milliseconds: 250),
Implementation
void throttle(String id, VoidCallback runner,
{bool leaky = false,
Duration cooldown = const Duration(milliseconds: 250)}) {
_throttleFunctions.putIfAbsent(
id,
() => leaky
? _LeakingThrottleFunction(cooldown, runner)
: ThrottleFunction(cooldown, runner));
_throttleFunctions[id]!.runner = runner;
_throttleFunctions[id]!();
}