start method

void start()

Starts the game loop, synchronized to the display's vsync when a SchedulerBinding is available (less jitter → less VR motion sickness than a fixed 16ms timer). Falls back to a ~60fps timer in headless environments (tests, isolates without a binding).

Implementation

void start() {
  if (_running) return;
  _running = true;
  _lastTime = DateTime.now();
  try {
    _ticker = Ticker((_) => _tick())..start();
  } catch (_) {
    _ticker = null;
    _timer = Timer.periodic(const Duration(milliseconds: 16), (_) => _tick());
  }
}