smart_debouncer 0.0.2
smart_debouncer: ^0.0.2 copied to clipboard
A smart debouncer that dynamically adjusts delay using Exponential Moving Average (EMA) based on actual typing speed. Perfect for autocomplete/search API optimization.
0.0.2 #
- Fixed: Renamed internal variable
dynamictorawDelayto avoid Dart keyword shadowing. - Added: Constructor assertions for parameter validation (
minDelay <= maxDelay,alphain range, etc.). - Added: Use-after-dispose guard — calling
run()afterdispose()now throws an assertion error. - Added:
reset()method to reset EMA to initial value (useful when search context changes). - Improved: Replaced
dart:uiimport withvoid Function()for better portability.
0.0.1 #
- Initial release.
SmartDebouncerclass with EMA-based dynamic delay calculation.- Configurable parameters:
minDelay,maxDelay,alpha,pauseThreshold,multiplier. - Pause detection to filter out natural typing pauses.
- Safety clamping to keep delay within min/max bounds.