cake_wallet/lib/utils/debounce.dart

14 lines
257 B
Dart
Raw Permalink Normal View History

2022-01-26 15:44:15 +00:00
import 'dart:async';
import 'package:flutter/foundation.dart';
class Debounce {
Debounce(this.duration);
final Duration duration;
2022-10-12 17:09:57 +00:00
Timer? _timer;
2022-01-26 15:44:15 +00:00
void run(VoidCallback action) {
_timer?.cancel();
_timer = Timer(duration, action);
}
}