update method

void update(
  1. double dt
)

Implementation

void update(double dt) {
  if (_running) {
    _current += dt;
    if (_current >= limit) {
      if (!repeat) {
        _running = false;
        onTick?.call();
        return;
      }
      // This is used to cover the rare case of _current being more than
      // two times the value of limit, so that the onTick is called the
      // correct number of times
      while (_current >= limit) {
        _current -= limit;
        onTick?.call();
      }
    }
  }
}