throttleOnTapIfNeeded method

  1. @protected
VoidCallback? throttleOnTapIfNeeded()

Implementation

@protected
VoidCallback? throttleOnTapIfNeeded() {
  if (widget.isEnabled) {
    if (widget.shouldTrottleTime) {
      subscribeToTrottlerEvents();

      return () => trottler.add(widget.onTap);
    }

    unsubscribeToTrottlerEventsIfNeeded();

    return widget.onTap;
  }

  unsubscribeToTrottlerEventsIfNeeded();

  return null;
}