debouncer 0.0.2 copy "debouncer: ^0.0.2" to clipboard
debouncer: ^0.0.2 copied to clipboard

Dart 1 only

Provides a Debouncer class which can be initiated with a duration

Debouncer #

Quick start: #

import 'package:debouncer/debouncer.dart';

So, somewhere in your application:

Debouncer debouncer = new Debouncer(1000);
List<String> logs = [];

onChange(String val) {
  debouncer.run(logs.add, [val]);
}

So in this case logs.add will only be called with a single parameter that is val, when time between invocations is larger than 1000 milliseconds.

If the parameters change between calls to .run, only the last parameters which are passed are going to be used when the calls do not occur for given milliseconds.

If you call the same instance with different functions, only the last used function will be called when the calls do not occur for given milliseconds.

0
likes
5
pub points
29%
popularity

Publisher

unverified uploader

Provides a Debouncer class which can be initiated with a duration

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on debouncer