onBeginFrame property

FrameCallback onBeginFrame

A callback that is invoked to notify the application that it is an appropriate time to provide a scene using the SceneBuilder API and the render method. When possible, this is driven by the hardware VSync signal. This is only called if scheduleFrame has been called since the last time this callback was invoked.

The onDrawFrame callback is invoked immediately after onBeginFrame, after draining any microtasks (e.g. completions of any Futures) queued by the onBeginFrame handler.

The framework invokes this callback in the same zone in which the callback was set.

See also:

  • SchedulerBinding, the Flutter framework class which manages the scheduling of frames.
  • RendererBinding, the Flutter framework class which manages layout and painting.


FrameCallback get onBeginFrame => _onBeginFrame;
void onBeginFrame= (FrameCallback callback)


set onBeginFrame(FrameCallback callback) {
  _onBeginFrame = callback;
  _onBeginFrameZone = Zone.current;