Search packages, repositories and app categories

Package detailsv2.0.1

throttling

Contain "throttling" and "debouncing" async helper classes with listeners

AndroidiOSWebmacOSWindowsLinux
30-day downloads
17.9K
Likes
44
Pub points
140

Install package

flutter pub add throttling

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The throttling package provides async helper classes for implementing throttling and debouncing in Dart applications. It enables developers to control the rate at which functions are executed, preventing excessive calls during rapid events such as user input or network requests. With built-in listener support, it simplifies managing delayed or rate-limited operations across platforms. Ideal for optimizing performance in reactive UIs and real-time data handling.

Use cases

  • Rate-limiting user input events
  • Optimizing network request frequency
  • Improving UI responsiveness
  • Managing real-time data updates
  • Reducing redundant computations
  • Handling scroll or resize events

Key features

  • Throttling and debouncing utilities
  • Async-compatible with listeners
  • Cross-platform support
  • Simple API for rate limiting
  • Built-in cancellation handling
  • Support for both sync and async functions

Suitable for

  • Developers building responsive Flutter apps
  • Teams needing event rate control
  • Apps with frequent user interactions
  • Real-time data processing scenarios
  • Performance-critical applications

Considerations

  • Requires understanding of async flow
  • May add latency if thresholds are too strict
  • Not suitable for immediate execution needs
  • Listeners must be managed to avoid memory leaks
  • Best used with state management patterns

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

THROTTLING DART LIBRARY

contain "throttling" and "debouncing" classes

Actions Status Coverage Pub License: MIT Effective Dart Star on Github

Using

See a demonstration of use at dartpad.dev

Throttling example
final thr = Throttling<void>(duration: const Duration(milliseconds: 200));
thr.throttle(() {print(' * 1');}); // print ' * 1'
await Future<void>.delayed(const Duration(milliseconds: 100));
thr.throttle(() {print(' * 2');});
await Future<void>.delayed(const Duration(milliseconds: 100));
thr.throttle(() {print(' * 3');}); // print ' * 3'
thr.close();
Debouncing example
final deb = Debouncing<void>(duration: const Duration(milliseconds: 200));
deb.debounce(() {print(' * 1');});
await Future<void>.delayed(const Duration(milliseconds: 100));
deb.debounce(() {print(' * 2');});
await Future<void>.delayed(const Duration(milliseconds: 100));
deb.debounce(() {print(' * 3');});
await Future<void>.delayed(const Duration(milliseconds: 200));
// print ' * 3'
deb.close();

Categories

Source repository

Projects using this package