One UI in flutter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
379 B

2 years ago
import 'dart:async';
import 'package:flutter/material.dart';
class FxDebouncer {
final int milliseconds;
VoidCallback? action;
Timer? _timer;
FxDebouncer({
required this.milliseconds,
this.action,
});
run(VoidCallback action) {
if (_timer != null) {
_timer!.cancel();
}
_timer = Timer(Duration(milliseconds: milliseconds), action);
}
}