- override
Called by the engine to produce a new frame.
This function first calls all the callbacks registered by
scheduleFrameCallback
/addFrameCallback
, then calls all the callbacks
registered by addPersistentFrameCallback
, which typically drive the
rendering pipeline, and finally calls the callbacks registered by
addPostFrameCallback
.
If the given time stamp is null, the time stamp from the last frame is reused.
To have a banner shown at the start of every frame in debug mode, set
debugPrintBeginFrameBanner
to true. The banner will be printed to the
console using debugPrint
and will contain the frame number (which
increments by one for each frame), and the time stamp of the frame. If the
given time stamp was null, then the string "warm-up frame" is shown
instead of the time stamp. This allows you to distinguish frames eagerly
pushed by the framework from those requested by the engine in response to
the vsync signal from the operating system.
You can also show a banner at the end of every frame by setting
debugPrintEndFrameBanner
to true. This allows you to distinguish log
statements printed during a frame from those printed between frames (e.g.
in response to events or timers).
Source
@override void handleBeginFrame(Duration rawTimeStamp) { if (_expectingFrame || allowAllFrames) super.handleBeginFrame(rawTimeStamp); if (_expectingFrame) { assert(_pendingFrame != null); _pendingFrame.complete(); // unlocks the test API _pendingFrame = null; _expectingFrame = false; } else { ui.window.scheduleFrame(); } }