flutter_debounce_kit library
A flexible, strategy-based debouncer library for Flutter and Dart.
Quick start
import 'package:flutter_debouncer_kit/flutter_debouncer_kit_kit.dart';
final debouncer = Debouncer(delay: Duration(milliseconds: 300));
debouncer.run(() => print('fired!'));
In a StatefulWidget (recommended)
class _MyState extends State<MyWidget> with DebouncerMixin {
void _onChanged(String v) => debounce(() => search(v));
}
Classes
- BothEdgeStrategy
- Fires the action on both the leading and trailing edge.
- Debouncer
- A flexible, strategy-based debouncer for Flutter and Dart.
- DebouncerConfig
- Configuration options for a Debouncer instance.
- DebouncerLogger
- Optional logger you can attach to a Debouncer for debugging.
- DebouncerStrategy
- Abstract base class for all debounce strategies.
- LeadingEdgeStrategy
- Fires the action immediately on the first call, then ignores subsequent calls until DebouncerConfig.delay has elapsed.
- LifecycleHooks
- Hooks that fire at key points in a Debouncer's lifecycle.
- TrailingEdgeStrategy
- Fires the action once, after DebouncerConfig.delay has passed since the last call.
Enums
- DebouncerLogLevel
- Log levels used by DebouncerLogger.
Mixins
-
DebouncerMixin<
T extends StatefulWidget> - A mixin for State subclasses that manages a Debouncer automatically.
- Disposable
- Mixin that marks a class as holding resources that must be freed.
Extensions
- DebouncedFunction on void Function()
- Extension on Function to create debounced versions directly.
- DebouncedFunction1 on void Function(A)
- Extension on single-argument functions for debounced use.