Skip to content

Releases: brewkits/flutter_debounce_throttle

v2.4.5

04 Mar 02:00
1f6879b

Choose a tag to compare

Changes

Package Metadata Updates

dart_debounce_throttle

  • Updated description to clarify server-side usage (Serverpod, Dart Frog)
  • Added topics: server, redis for better discoverability
  • Fixed flutter_debounce_throttle_core dependency version

flutter_debounce_throttle

  • Updated description to highlight Redis rate limiting and gesture throttling
  • Changed topic from production to widgets
  • Updated dart_debounce_throttle dependency to ^2.4.5

flutter_debounce_throttle_hooks

  • Updated description to mention React-style hooks pattern
  • Added topics: hooks, react
  • Updated flutter_debounce_throttle dependency to ^2.4.5

Code Cleanup

  • Fixed relative imports in example/test files
  • Removed unused imports in redis_example.dart
  • Synchronized cross-package dependency versions

Notes

  • No API changes
  • No breaking changes
  • All functionality identical to v2.4.2

Package Links

v2.4.4 - Update metadata

19 Feb 07:10
5863d53

Choose a tag to compare

SEO & Polish

Improved pub.dev search ranking and codebase cleanup.

What Changed

  • Improved pub.dev descriptions on all 3 packages — keyword-first for better search ranking
  • Cleaned root example app — removed stale v1.1.0 version comments
  • Updated roadmap language: more honest about future plans

Packages

Package Version
dart_debounce_throttle 2.4.4
flutter_debounce_throttle 2.4.4
flutter_debounce_throttle_hooks 2.4.4

No Breaking Changes

v2.4.3 - Documentation & Discoverability

19 Feb 05:02

Choose a tag to compare

Documentation & Discovery

Improved pub.dev discoverability, cleaner READMEs, and release process improvements.

What Changed

  • Restructured READMEs: quick start code moved to the top (before comparisons/diagrams)
  • Root README trimmed from 559 lines to ~240 lines
  • Improved pub.dev description keywords for better search ranking
  • Updated topics on all packages: removed production, added searchable terms
  • Added CONTRIBUTING.md with release policy (prevents version churn)
  • Added ## Which Package Should I Use? decision guide in all READMEs
  • Fixed test count badges: flutter 450+, dart 50+, root 500+

Packages

Package Version
dart_debounce_throttle 2.4.3
flutter_debounce_throttle 2.4.3
flutter_debounce_throttle_hooks 2.4.3

No Breaking Changes

v2.4.1 - Quality Improvements & Test Coverage

26 Jan 16:30

Choose a tag to compare

🎯 What's New in v2.4.1

This is a quality-focused patch release that improves pub.dev scores, adds comprehensive test coverage, and cleans up documentation.


📦 Published Packages

All three packages have been updated to v2.4.1:


🔧 Bug Fixes & Quality Improvements

dart_debounce_throttle

  • Fixed redundant length check in RateLimiterState.fromList() (pub.dev lint warning)
  • Applied dart fix auto-corrections
  • Improved pub.dev score: targeting 160/160 pub points

flutter_debounce_throttle

  • Applied dart fix: use_super_parameters (2 fixes)
  • Applied dart fix: sized_box_for_whitespace (1 fix)
  • Fixed missing import in gesture_detector_demo.dart
  • Updated example dependencies to use local path

flutter_debounce_throttle_hooks

  • Applied dart fix across codebase
  • All packages now pass dart analyze with 0 issues

✅ Test Coverage (NEW!)

Added 16 comprehensive tests for flutter_debounce_throttle_hooks:

Hook Coverage (100%)

  • useDebouncer - Instance creation & debounce behavior
  • useThrottler - Instance creation & throttle behavior
  • useDebouncedCallback - Callback debouncing
  • useThrottledCallback - Callback throttling
  • useDebouncedValue - Value debouncing
  • useThrottledValue - Value throttling
  • useAsyncDebouncer - Async debouncing
  • useAsyncThrottler - Async throttling

Additional Test Coverage

  • Lifecycle management (auto-dispose on unmount)
  • Keys parameter handling (hook recreation on key change)
  • Multiple hooks coexistence in same widget
  • Hook persistence across rebuilds

Total Test Cases Across All Packages: 357 (16 new in this release)


📚 Documentation Improvements

flutter_debounce_throttle_hooks

  • ❌ Removed outdated "v1.1.0 Features" section (was misleading)
  • ❌ Removed inaccurate "50+ tests" badge
  • ✅ Updated Quality Assurance section with accurate information
  • ✅ Clarified that package is built on flutter_debounce_throttle (340+ tests)

📊 Quality Metrics

✅ All packages pass dart analyze with 0 issues
✅ All 357 tests passing (100% pass rate)
✅ Improved pub.dev scores
✅ Zero warnings in production code

🚀 Upgrade Guide

This is a patch release with no breaking changes. Simply update your pubspec.yaml:

dependencies:
  dart_debounce_throttle: ^2.4.1            # or
  flutter_debounce_throttle: ^2.4.1         # or
  flutter_debounce_throttle_hooks: ^2.4.1

Then run:

flutter pub upgrade

📦 What's Next?

v2.4.1 is a quality-focused release. All features from v2.4.0 remain unchanged:

  • ✅ ThrottledGestureDetector (flutter_debounce_throttle)
  • ✅ DistributedRateLimiter (dart_debounce_throttle)
  • ✅ All 8 hooks (flutter_debounce_throttle_hooks)

See v2.4.0 release notes for major features.


Full Changelog: v2.4.0...v2.4.1

v2.4.0 - Enterprise Features: ThrottledGestureDetector & Distributed Rate Limiting

26 Jan 10:38

Choose a tag to compare

🚀 Major Features

ThrottledGestureDetector - Universal Gesture Throttling

Drop-in replacement for GestureDetector with built-in throttling for all 40+ gesture callbacks.

Key Features:

  • Smart Dual-Throttle Strategy
    • Discrete events (tap, long press): 500ms default
    • Continuous events (pan, scale, drag): 16ms (60fps) for smooth animations
  • Zero Configuration - Just replace GestureDetector with ThrottledGestureDetector
  • Automatic Lifecycle Management - Auto-dispose on widget unmount
  • Production Ready - Fully tested with 16 widget tests

Example:

ThrottledGestureDetector(
  onTap: () => handleTap(),
  onPanUpdate: (details) => updatePosition(details.delta),
  onScaleUpdate: (details) => zoom(details.scale),
  child: MyWidget(),
)

DistributedRateLimiter - Backend Scaling

Async rate limiter for multi-server distributed systems with Redis/Memcached support.

Key Features:

  • Distributed State - Share rate limits across all server instances
  • Redis/Memcached - Built-in reference implementations
  • Custom Storage - Implement AsyncRateLimiterStore for any backend
  • Token Bucket Algorithm - Industry-standard rate limiting
  • Fail-Safe Design - Atomic operations with graceful degradation

Server-Side Example:

final store = RedisRateLimiterStore(
  redis: redis,
  keyPrefix: 'api:',
);

final limiter = DistributedRateLimiter(
  key: 'user-$userId',
  store: store,
  maxTokens: 100,
  refillRate: 10,
  refillInterval: Duration(seconds: 1),
);

if (!await limiter.tryAcquire()) {
  return Response.tooManyRequests();
}

📦 What's Included

New APIs

  • ThrottledGestureDetector widget
  • DistributedRateLimiter class
  • RateLimiterStore interface (sync)
  • AsyncRateLimiterStore interface (async)
  • InMemoryRateLimiterStore (sync + async)
  • RedisRateLimiterStore (reference implementation)
  • MemcachedRateLimiterStore (reference implementation)
  • RateLimiterState data class

Testing

  • ✅ 35+ tests for distributed rate limiting (100% coverage)
  • ✅ 16 widget tests for ThrottledGestureDetector
  • ✅ Total: 380+ tests passing
  • ✅ Integration tests for Redis/Memcached stores

Documentation

  • 📚 Comprehensive README updates
  • 📚 Server-side integration examples
  • 📚 Custom storage backend guide
  • 📚 Demo app with interactive gesture detector
  • 📚 CHANGELOG with migration guide

🔄 Migration from v2.3.x

No breaking changes! All existing code continues to work without modifications.

This release only adds new features. You can adopt them at your own pace:

  • Use ThrottledGestureDetector where you need gesture throttling
  • Use DistributedRateLimiter when scaling to multiple servers
  • Existing RateLimiter continues to work as before

📊 Package Updates

All three packages updated to v2.4.0:

  • dart_debounce_throttle: ^2.4.0 (Pure Dart core)
  • flutter_debounce_throttle: ^2.4.0 (Flutter widgets)
  • flutter_debounce_throttle_hooks: ^2.4.0 (Hooks integration)

🎯 Use Cases

ThrottledGestureDetector is perfect for:

  • Interactive drag & drop interfaces
  • Drawing/painting apps
  • Games with touch controls
  • Zoom/pan/rotate gestures
  • Custom gesture-based navigation

DistributedRateLimiter is perfect for:

  • Multi-server API rate limiting
  • Microservices rate control
  • Kubernetes deployments
  • Serverless functions (AWS Lambda, Cloud Functions)
  • SaaS multi-tenancy rate limiting

🏆 Quality Metrics

  • Tests: 380+ passing
  • Coverage: 95%+
  • Pub Score: 160/160 ⭐
  • Zero Dependencies (except meta)
  • Pure Dart Core - Works everywhere

📝 Full Changelog

See CHANGELOG.md for detailed changes.


🙏 Thank You!

Thank you for using flutter_debounce_throttle! If you find these new features useful, please consider:

  • ⭐ Starring the repo
  • 📣 Sharing with your team
  • 🐛 Reporting any issues
  • 💡 Suggesting improvements

Made with ❤️ by Brewkits

v2.3.1 - Metadata Fix

21 Jan 13:53

Choose a tag to compare

Metadata Fix - Fixed package description to meet pub.dev requirements.

What Changed

  • Shortened dart_debounce_throttle description to 129 characters (within 60-180 limit)
  • Updated all package dependencies to ^2.3.1
  • Improved pub.dev score compliance

No Code Changes

This is a metadata-only release. All functionality remains identical to v2.3.0.

v2.3.0 - Production-Safe Defaults

21 Jan 12:10

Choose a tag to compare

Production-Safe Defaults - Auto-cleanup enabled by default to prevent memory leaks.

🛡️ Breaking Change (Behavior)

IMPORTANT: Auto-cleanup is now enabled by default to prevent memory leaks with dynamic IDs.

  • Old behavior: limiterAutoCleanupTTL defaulted to null (disabled)
  • New behavior: limiterAutoCleanupTTL defaults to Duration(minutes: 10) (enabled)

Impact:

  • ✅ No code changes needed for most apps
  • ✅ Apps using dynamic IDs are now safer by default
  • ✅ Limiters unused for 10+ minutes are auto-removed when count exceeds 100
  • ✅ Actively used limiters are never cleaned up

Migration:

// To keep old behavior (disable auto-cleanup):
DebounceThrottleConfig.init(
  limiterAutoCleanupTTL: null,  // Explicitly disable
);

📦 What Changed

  • Default limiterAutoCleanupTTL: nullDuration(minutes: 10)
  • Updated documentation to reflect new defaults
  • Added tests for default behavior
  • Enhanced examples to show auto-cleanup is enabled by default

🎯 Why This Change?

Memory leaks with dynamic IDs can cause production crashes. Making auto-cleanup the default ensures apps are safe by default, following the principle of "secure by default."

v2.2.0 - Production Safety & Memory Management

20 Jan 23:37

Choose a tag to compare

🛡️ Error Handling

  • Added onError callbacks to all limiters (Debouncer, Throttler, AsyncDebouncer, AsyncThrottler)
  • Firebase Crashlytics and Sentry integration support
  • No more silent failures in production

🧹 Memory Management

  • TTL-based auto-cleanup to prevent memory leaks
  • Manual cleanup APIs: cleanupInactive() and cleanupUnused()
  • Memory monitoring with totalLimitersCount

⚡ Performance

  • Fixed O(N) performance issue in EventLimiterMixin
  • 100-1000x faster for repeated limiter calls
  • UI thread optimized

📦 What's Included

  • Error handling for all 4 limiter types
  • TTL-based auto-cleanup with configurable threshold
  • Performance optimization
  • 48 comprehensive tests (100% passing)
  • Zero breaking changes - fully backward compatible

🔧 Migration

No migration needed - all changes are opt-in and backward compatible.

v2.0.0 - dart_debounce_throttle Package Rename

19 Jan 04:12

Choose a tag to compare

dart_debounce_throttle v2.0.0

BREAKING CHANGE - Package renamed to follow Dart naming conventions.

What Changed

The package has been renamed from flutter_debounce_throttle_core to dart_debounce_throttle.

Pure Dart packages should not have the flutter_ prefix, as this package has zero Flutter dependencies and works in any Dart environment (server, CLI, web, mobile).

Migration Guide

1. Update pubspec.yaml:

```yaml

Before

dependencies:
flutter_debounce_throttle_core: ^1.1.0

After

dependencies:
dart_debounce_throttle: ^2.0.0
```

2. Update imports:

```dart
// Before
import 'package:flutter_debounce_throttle_core/flutter_debounce_throttle_core.dart';

// After
import 'package:dart_debounce_throttle/dart_debounce_throttle.dart';
```

3. Run pub get:

```bash
dart pub get # or flutter pub get
```

No API Changes

All classes, methods, and functionality remain exactly the same. Only the package name and import path have changed.

Packages Included

  • dart_debounce_throttle v2.0.0 - Pure Dart debounce & throttle (renamed from flutter_debounce_throttle_core)
  • flutter_debounce_throttle v2.0.0 - Flutter integration with widgets & mixins
  • flutter_debounce_throttle_hooks v2.0.0 - Optional Flutter Hooks support

Links

v1.1.0 - Enterprise Features

16 Jan 14:08

Choose a tag to compare

Enterprise Features Release

Advanced event limiting capabilities for production workloads.

New Features

RateLimiter (Token Bucket Algorithm)

final limiter = RateLimiter(
  maxTokens: 10,           // Burst capacity
  refillRate: 2,           // 2 tokens/second
  refillInterval: Duration(seconds: 1),
);

if (limiter.tryAcquire()) {
  await api.call();
} else {
  showRateLimitError();
}

Duration Extensions

300.ms      // Duration(milliseconds: 300)
2.seconds   // Duration(seconds: 2)
5.minutes   // Duration(minutes: 5)

Callback Extensions

final debouncedSearch = search.debounced(300.ms);
final throttledSave = save.throttled(500.ms);

Leading/Trailing Edge Debouncer

final debouncer = Debouncer(
  duration: Duration(milliseconds: 300),
  leading: true,   // Execute immediately on first call
  trailing: true,  // Also execute after pause (lodash-style)
);

BatchThrottler with maxBatchSize

final batcher = BatchThrottler(
  duration: Duration(seconds: 1),
  onBatchExecute: (actions) async => await bulkInsert(actions),
  maxBatchSize: 100,  // Prevent OOM
  overflowStrategy: BatchOverflowStrategy.flushAndAdd,
);

ConcurrentAsyncThrottler with maxQueueSize

final throttler = ConcurrentAsyncThrottler(
  mode: ConcurrencyMode.enqueue,
  maxQueueSize: 10,  // Limit queue
  queueOverflowStrategy: QueueOverflowStrategy.dropOldest,
);

Backward Compatible

All new features have null defaults - existing code continues to work without changes.

Packages

  • flutter_debounce_throttle_core: 1.1.0
  • flutter_debounce_throttle: 1.1.0
  • flutter_debounce_throttle_hooks: 1.1.0