delayed method
Starts delay for given duration
. Given callback can be postponed or canceled.
Can be called multiple times - only last call will be handled.
Implementation
void delayed(Duration duration, VoidCallback? onDone) {
cancel();
if (onDone == null) {
printDebug('FutureBlock: null callback - delay not started');
return;
}
_callback = onDone;
_timer = Timer(duration, () {
onDone();
cancel();
});
}