doubleClickConfirmation static method
Future<bool>
doubleClickConfirmation({
- int? interval = 1000,
- VoidCallback? first,
- VoidCallback? second,
Implementation
static Future<bool> doubleClickConfirmation({int? interval = 1000, VoidCallback? first, VoidCallback? second}) {
int now = DateTime.now().millisecondsSinceEpoch;
if (now - _doubleClickConfirmation > (interval ?? 1000)) {
_doubleClickConfirmation = DateTime.now().millisecondsSinceEpoch;
first?.call();
return Future.value(false);
} else {
second?.call();
return Future.value(true);
}
}