throttle method

void throttle(
  1. VoidCallback callback
)

Implementation

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