void timerOnceBetween(Function callback, int after, int before)

do nothing if the callback is already in the list and will get called after M to N ms

Source

static void timerOnceBetween(Function callback, int after, int before) {
  int desiredTime50_0 =
      (((new DateTime.now()).millisecondsSinceEpoch + after) / 50).ceil();
  int desiredTime50_1 =
      (((new DateTime.now()).millisecondsSinceEpoch + before) / 50).ceil();
  if (_functionsMap.containsKey(callback)) {
    TimerFunctions existTf = _functionsMap[callback];
    if (existTf.ts50 >= desiredTime50_0 && existTf.ts50 <= desiredTime50_1) {
      return;
    } else {
      existTf.remove(callback);
    }
  }
  if (desiredTime50_1 <= _lastTimeRun) {
    callLater(callback);
    return;
  }
  TimerFunctions tf = _getTimerFunctions(desiredTime50_1);
  tf.add(callback);
  _functionsMap[callback] = tf;
}