onDrawFrame property

VoidCallback onDrawFrame

A callback that is invoked for each frame after onBeginFrame has completed and after the microtask queue has been drained. This can be used to implement a second phase of frame rendering that happens after any deferred work queued by the onBeginFrame phase.

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.


VoidCallback get onDrawFrame => _onDrawFrame;
void onDrawFrame= (VoidCallback callback)


set onDrawFrame(VoidCallback callback) {
  _onDrawFrame = callback;
  _onDrawFrameZone = Zone.current;