Skip to content
pubscout

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.

WASM-ready
$ flutter pub add rate_limiter
Source repository

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.

Works with

Packages commonly used together with rate_limiter: ones it builds on, ones built on it, and its own family.