pkg_rate_limit version: 0.0.23

Published 2025-09-03

ruud

sdk | dart
repository | svn
platform | generic
status | n/a
  • Readme
  • Changelog
  • Versions

pkg_rate_limit

Private port of rate_limit: 0.1.0 that was abandoned.

  • All classes renamed with prefix HH.
  • Fixed all warnings.
  • Upgraded to Dart 3.2 syntax.

graph

  • Provides the following StreamTransformers to limit the rate at which a Stream emits events.

HHThrottler

Enforces a wait period between events.

// Avoid excessively updating the position while scrolling.
window.onScroll
 .transform(HHThrottler(const Duration(milliseconds: 100)))
 .forEach(updatePosition);
 
// Execute `renewToken` on click, but not more than once every 5 minutes.
querySelector('.interactive').onClick
 .transform(HHThrottler(const Duration(minutes: 5), trailing: false))
 .forEach(renewToken);

Debouncer

Enforces a quiet wait period between events.

// Avoid costly calculations while the window size is in flux.
window.onResize
 .transform(HHDebouncer(const Duration(milliseconds: 150)))
 .forEach(calculateLayout);

// Execute `sendMail` on click, debouncing subsequent calls.
querySelector('#postbox').onClick
 .transform(new Debouncer(const Duration(milliseconds: 300), leading: true, trailing: false))
 .forEach(sendMail);

// Ensure `batchLog` is executed once after 1 second of debounced calls.
var source = EventSource('/stream');
source.onMessage
 .transform(HHDebouncer(const Duration(milliseconds: 250), maxWait: const Duration(seconds: 1)))
 .forEach(batchLog);

Inspired by lodash's throttle and debounce.

Changelog

0.0.23 - 2025-09-03

Fixed

  • Unawaited futures.

0.0.22 - 2025-07-23

Changed

  • Version bump from 0.0.21 to 0.0.22 (test -> 1.26.3 (was 1.26.2)).

0.0.21 - 2025-05-22

Changed

  • Version bump from 0.0.20 to 0.0.21 (lints -> 6.0.0 (was 5.1.1)).

0.0.20 - 2025-05-22

Changed

  • Version bump from 0.0.19 to 0.0.20 (fake_async -> 1.3.3 (was 1.3.2)).

0.0.19 - 2025-05-22

Changed

  • Version bump from 0.0.18 to 0.0.19 (test -> 1.26.2 (was 1.26.1)).

0.0.18 - 2025-05-21

Changed

  • Version bump from 0.0.17 to 0.0.18 (fake_async -> 1.3.2 (was 1.3.3)).

0.0.17 - 2025-05-20

Changed

  • Version bump from 0.0.16 to 0.0.17 (test -> 1.26.1 (was 1.26.0)).

0.0.16 - 2025-05-13

Changed

  • Version bump from 0.0.15 to 0.0.16 (test -> 1.26.0 (was 1.25.15)).

0.0.15 - 2025-04-02

Changed

  • Version bump from 0.0.14 to 0.0.15 (test -> 1.25.15 (was 1.25.14)).

0.0.14 - 2025-01-31

Changed

  • Version bump from 0.0.13 to 0.0.14 (fake_async -> 1.3.3 (was 1.3.1)).

0.0.13 - 2025-01-29

Changed

  • Version bump from 0.0.12 to 0.0.13 (fake_async -> 1.3.1 (was 1.3.3)).

0.0.12 - 2025-01-29

Changed

  • Version bump from 0.0.11 to 0.0.12 (fake_async -> 1.3.3 (was 1.3.1)).

0.0.11 - 2024-12-23

Changed

  • Version bump from 0.0.10 to 0.0.11 (test -> 1.25.14 (was 1.25.13)).

0.0.10 - 2024-12-23

Changed

  • Version bump from 0.0.9 to 0.0.10 (lints -> 5.1.1 (was 5.1.0)).

0.0.9 - 2024-12-19

Changed

  • Version bump from 0.0.8 to 0.0.9 (Support Apple silicon (arm64)).

0.0.8 - 2024-12-18

Changed

  • Version bump from 0.0.7 to 0.0.8 (test -> 1.25.13 (was 1.25.12)).

0.0.7 - 2024-12-12

Changed

  • Version bump from 0.0.6 to 0.0.7 (lints -> 5.1.0 (was 5.0.0)).

0.0.6 - 2024-12-05

Changed

  • Version bump from 0.0.5 to 0.0.6 (test -> 1.25.12 (was 1.25.11)).

0.0.5 - 2024-12-04

Changed

  • Version bump from 0.0.4 to 0.0.5 (test -> 1.25.11 (was 1.25.10)).

0.0.4 - 2024-12-03

Changed

  • Version bump from 0.0.3 to 0.0.4 (test -> 1.25.10 (was 1.25.9)).

0.0.3 - 2024-11-27

Changed

  • Version bump from 0.0.2 to 0.0.3 (test -> 1.25.9 (was 1.25.8)).

0.0.2 - 2024-08-22

Changed

  • Version bump from 0.0.1 to 0.0.2 (SDK update 3.5.1).

0.0.1 - 2024-03-26

  • Initial version.

0.0.23

2025-09-03 download

0.0.22

2025-07-23 download

0.0.21

2025-05-22 download

0.0.18

2025-05-21 download

0.0.17

2025-05-20 download

0.0.16

2025-05-13 download

0.0.15

2025-04-02 download

0.0.14

2025-01-31 download

0.0.11

2024-12-23 download

0.0.9

2024-12-19 download

0.0.8

2024-12-18 download

0.0.7

2024-12-12 download

0.0.3

2024-11-27 download

0.0.2

2024-08-22 download

0.0.1

2024-03-26 download