void timerOnceBefore(Function callback, int ms)

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

Source

static void timerOnceBefore(Function callback, int ms) {
  int desiredTime50 =
      (((new DateTime.now()).millisecondsSinceEpoch + ms) / 50).ceil();
  if (_functionsMap.containsKey(callback)) {
    TimerFunctions existTf = _functionsMap[callback];
    if (existTf.ts50 <= desiredTime50) {
      return;
    } else {
      existTf.remove(callback);
    }
  }

  if (desiredTime50 <= _lastTimeRun) {
    callLater(callback);
    return;
  }
  TimerFunctions tf = _getTimerFunctions(desiredTime50);
  tf.add(callback);
  _functionsMap[callback] = tf;
}