throttle method

void throttle(
  1. VoidCallback callback
)

Implementation

void throttle(VoidCallback callback) {
  final now = DateTime.now();
  if (_lastThrottleRun == null ||
      now.difference(_lastThrottleRun!) >= throttleDuration) {
    _lastThrottleRun = now;
    callback();
  }
}