flutter_debounce_throttle_core 1.1.0 copy "flutter_debounce_throttle_core: ^1.1.0" to clipboard
flutter_debounce_throttle_core: ^1.1.0 copied to clipboard

Pure Dart debounce, throttle, and rate limiting. Zero dependencies, works everywhere - Mobile, Web, Desktop, Server, CLI.

example/example.dart

import 'package:flutter_debounce_throttle_core/flutter_debounce_throttle_core.dart';

void main() async {
  print('=== Debounce Example ===');
  final debouncer = Debouncer(duration: Duration(milliseconds: 500));

  // Rapid calls - only the last one executes after 500ms of silence
  for (int i = 0; i < 5; i++) {
    debouncer.call(() => print('Debounced: $i'));
    await Future.delayed(Duration(milliseconds: 100));
  }

  await Future.delayed(Duration(seconds: 1));

  print('\n=== Throttle Example ===');
  final throttler = Throttler(duration: Duration(milliseconds: 500));

  // Rapid calls - first executes immediately, rest are blocked for 500ms
  for (int i = 0; i < 5; i++) {
    throttler.call(() => print('Throttled: $i'));
    await Future.delayed(Duration(milliseconds: 100));
  }

  await Future.delayed(Duration(seconds: 1));

  // Cleanup
  debouncer.dispose();
  throttler.dispose();
}
0
likes
0
points
194
downloads

Publisher

verified publisherbrewkits.dev

Weekly Downloads

Pure Dart debounce, throttle, and rate limiting. Zero dependencies, works everywhere - Mobile, Web, Desktop, Server, CLI.

Repository (GitHub)
View/report issues

Topics

#debounce #throttle #rate-limiting #async #dart

License

unknown (license)

Dependencies

meta

More

Packages that depend on flutter_debounce_throttle_core