
import 'dart:async';

Timer setInterval(void Function (Timer) f, int milliseconds) {
  var duration = Duration(milliseconds: milliseconds);
  return Timer.periodic(duration, f);
}

void setTimeout(void Function () f, int milliseconds) {
  var duration = Duration(milliseconds: milliseconds);
  Timer? t = null;
  t = Timer(duration, () {
    if (null != t) {
      t.cancel();
    }
    f();
  });
}
