call method

dynamic call(
  1. void callback()
)

Implementation

call(void Function() callback) {
  if (_isDisposed) {
    throw IllegalStateException(
      message: 'Can\'t call debouncer after dispose.',
    );
  }

  _currentCallback = callback;
  _isPending = true;

  _timer?.cancel();

  _timer = Timer(delay, () {
    callback();
    _isPending = false;
  });
}