timer static method

Timer timer(
  1. int milliseconds,
  2. VoidCallback callback
)

Create a timer that will execute an instruction after an amount of milliseconds. The goodness and difference it has with the Misc.delayed() is that has the ability to be canceled and thus the callback will not be executed.

DO THAT:

return Timer(Duration(milliseconds: milliseconds), callback);

Implementation

static Timer timer(int milliseconds, VoidCallback callback) {
  return Timer(Duration(milliseconds: milliseconds), callback);
}