throttling
2.0.1, released 3 years ago by plugfox.dev
Throttling and debouncing async helper classes with listeners in Dart
WASM-ready
What it does
Provides throttling and debouncing utility classes to control the rate at which asynchronous actions or functions are executed. The classes extend Stream<bool> and implement Sink<Function> for integration.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to limit how often a function can be called, such as handling button clicks or window resize events
- You need to debounce user input like search queries
Skip it when
- You already use reactive streams or libraries like RxDart that handle debouncing and throttling natively
Strengths
- Zero dependencies
- Supports multiple platforms (Dart and Flutter)
- Extends Stream and implements Sink
Weaknesses
- Very narrow scope focused solely on throttling and debouncing
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final thr = Throttling<void>(duration: const Duration(milliseconds: 200));
thr.throttle(() {print(' * 1');});
await Future<void>.delayed(const Duration(milliseconds: 100));
thr.close();Alternatives
Packages that do the same job and could replace throttling.
Works with
Packages commonly used together with throttling: ones it builds on, ones built on it, and its own family.