mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-02-12 16:52:51 +00:00
16 lines
257 B
Dart
16 lines
257 B
Dart
import 'dart:async';
|
|
|
|
class Debouncer {
|
|
Debouncer(this.duration);
|
|
final Duration duration;
|
|
Timer? _timer;
|
|
|
|
void call(void Function() action) {
|
|
_timer?.cancel();
|
|
_timer = Timer(duration, action);
|
|
}
|
|
|
|
void dispose() => _timer?.cancel();
|
|
}
|
|
|