render method

  1. @override
void render(
  1. Scene scene

Updates the view's rendering on the GPU with the newly provided Scene.

Requirement for calling this method

This method must be called within the synchronous scope of the PlatformDispatcher.onBeginFrame or PlatformDispatcher.onDrawFrame callbacks. Calls out of this scope will be ignored. To use this method, create a callback that calls this method instead, and assign it to either of the fields above; then schedule a frame, which is done typically with PlatformDispatcher.scheduleFrame. Also, make sure the callback does not have await before the FlutterWindow.render call.

Additionally, this method can only be called once for each view during a single PlatformDispatcher.onBeginFrame/PlatformDispatcher.onDrawFrame callback sequence. Duplicate calls will be ignored in production.

How to record a scene

To record graphical operations, first create a PictureRecorder, then construct a Canvas, passing that PictureRecorder to its constructor. After issuing all the graphical operations, call the PictureRecorder.endRecording function on the PictureRecorder to obtain the final Picture that represents the issued graphical operations.

Next, create a SceneBuilder, and add the Picture to it using SceneBuilder.addPicture. With the method you can then obtain a Scene object, which you can display to the user via this render function.

See also:

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


void render(Scene scene) {