callAsync function
Calls a function with a delayMs
.
delayMs
is milliseconds. If null or <= 0 won't have a delay.
Implementation
Future callAsync(int delayMs, Function() function) {
if (delayMs <= 0) {
return Future.microtask(function);
}
return Future.delayed(Duration(milliseconds: delayMs), function);
}