delay method
ignore last delay targetFunction and give delay to new one.
Implementation
void delay(Function function) {
targetFunction = function;
if (_timer != null) {
_timer!.cancel();
}
_timer = Timer(const Duration(milliseconds: 20), () {
if (targetFunction != null) {
targetFunction!();
}
});
}