throttle method

void throttle()

Implementation

void throttle() {
  final key = _generateKey();
  if (_funcThrottle[key] ?? true) {
    _funcThrottle[key] = false;
    target?.call();
    Timer(Duration(milliseconds: timeout), () {
      _funcThrottle.remove(key);
      if (trailing && (_throttlePending[key] ?? false)) {
        _throttlePending.remove(key);
        target?.call();
      }
    });
  } else if (trailing) {
    _throttlePending[key] = true;
  }
}