rate_limiter
1.1.1, released 3 months ago by getstream.io
Apply rate limiting strategies like debounce, throttle, and backoff to regular Dart functions.
What it does
A pure Dart package that provides rate limiting strategies such as debounce, throttle, and backoff for regular functions. It allows you to convert existing functions or build new ones with built-in checks for pending execution, flushing, and cancellation.
AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to debounce user input in a search box or text field.
- You want to throttle rapid button clicks for game actions or API triggers.
- You need to implement exponential backoff retry logic for network requests.
Skip it when
- You need complex stream-based reactive rate limiting rather than wrapping regular functions.
Strengths
- Simple extension methods for converting existing regular functions into debounced or throttled versions.
- Deterministic testing support via package:clock and fakeAsync.
- Supports flush, cancellation, and pending status checks.
Weaknesses
- Limited to pure Dart functions rather than fully reactive stream transformations.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
final debouncedAutocompleteSearch = debounce(
(String searchQuery) async {
final results = await searchApi.get(searchQuery);
updateSearchSuggestions(results);
},
const Duration(seconds: 1),
);Alternatives
Packages that do the same job and could replace rate_limiter.
- flutter_essentials_kit
A kit of useful functions and widgets to speed up development.
65Compare - schedulers
Dart library for running asynchronous functions on time with interval, rate, parallel, and lazy controls.
48Compare - screwdriver
Provides useful extensions and helper functions for Dart types to speed up development.
62Compare - brotli
Pure Dart Brotli decoder
50Compare
Works with
Packages commonly used together with rate_limiter: ones it builds on, ones built on it, and its own family.
- clockrate_limiter depends on itA fakeable wrapper for dart:core clock APIs.
- stream_chatBuilt on rate_limiterLow‑level Dart client for Stream Chat API
- stream_chat_flutter_coreBuilt on rate_limiterCore Flutter SDK for Stream Chat providing business logic and controllers without UI.
- stream_chat_flutterBuilt on rate_limiterFull-featured Flutter UI SDK for Stream Chat, providing ready‑made chat widgets and theming.
- stream_video_flutterBuilt on rate_limiterOfficial UI package and SDK for Stream Video, supporting calls and livestreams.