Last updated:
0 purchases
rw debouncer
About #
rw_debouncer provides a simple yet concrete implementation that will allow extending any function
with the ability of debouncing.
Features #
debounce: Debounce the function call by a pre-defined debouncing timeout.
flush: Execute the function immediately, if and only if there is at least one active invocation.
cancelDebouncedInvocation: Cancels the invocation of a specific debounce operation.
clearDebouncedInvocations: Cancels all the debounce operations, associated with any of the debouncing objects.
Getting started #
Add the dependency on pubspec.yaml:
rw_debouncer: 1.0.0
Usage #
Instantiate a new RwDebouncer object:
var debouncer = RwDebouncer<String>('ABC123', () => 'Hello', smallDebouncingTimeout);
copied to clipboard
Start debouncing:
var result = await debouncer.debounce();
copied to clipboard
Execute the operation associated with the debouncer instance immediately:
var result = debouncer.flush();
copied to clipboard
Cancel the debouncing operation with tracking id 'ABC123':
debouncer.cancelDebouncedInvocation('ABC123');
copied to clipboard
Clear all the debounced operations, associated with any of the debounced objects:
debouncer.clearDebouncedInvocations();
copied to clipboard
Additional information #
Please file any issues on the github issue tracker.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.