scheduleFrame method

void scheduleFrame ()

If necessary, schedules a new frame by calling Window.scheduleFrame.

After this is called, the engine will (eventually) call handleBeginFrame. (This call might be delayed, e.g. if the device's screen is turned off it will typically be delayed until the screen is on and the application is visible.) Calling this during a frame forces another frame to be scheduled, even if the current frame has not yet completed.

Scheduled frames are serviced when triggered by a "Vsync" signal provided by the operating system. The "Vsync" signal, or vertical synchronization signal, was historically related to the display refresh, at a time when hardware physically moved a beam of electrons vertically between updates of the display. The operation of contemporary hardware is somewhat more subtle and complicated, but the conceptual "Vsync" refresh signal continue to be used to indicate when applications should update their rendering.

To have a stack trace printed to the console any time this function schedules a frame, set debugPrintScheduleFrameStacks to true.

See also:

Implementation

void scheduleFrame() {
  if (_hasScheduledFrame || !_framesEnabled)
    return;
  assert(() {
    if (debugPrintScheduleFrameStacks)
      debugPrintStack(label: 'scheduleFrame() called. Current phase is $schedulerPhase.');
    return true;
  }());
  window.scheduleFrame();
  _hasScheduledFrame = true;
}