pmu/lib/Components/utils/debounce.dart
2024-12-16 22:27:12 +04:00

21 lines
353 B
Dart

import 'dart:async';
import 'dart:ui';
class Debouce {
factory Debouce() => _instance;
Debouce._();
static final Debouce _instance = Debouce._();
static Timer? _timer;
static void run(
VoidCallback action, {
Duration delay = const Duration(milliseconds: 500),
}) {
_timer?.cancel();
_timer = Timer(delay, action);
}
}