run<T> method
Implementation
Future<T?> run<T>(FutureOr<T> Function() action) {
final completer = Completer<T?>();
if (_timer?.isActive ?? false) {
_timer?.cancel();
}
_timer = Timer(
duration,
() async {
completer.complete(await action());
},
);
return completer.future;
}