render method

void render(
  1. Camera camera,
  2. Canvas canvas, {
  3. Rect? viewport,
  4. double? pixelRatio,
})

Renders camera's view of this scene onto canvas.

The Camera provides the perspective from which the scene is viewed, and the ui.Canvas is the drawing surface onto which this Scene is rendered.

Optionally, a ui.Rect viewport limits the rendering area on the canvas. If none is specified, the entire canvas is rendered.

pixelRatio is the multiplier from logical to physical pixels used when allocating the offscreen render target. Defaults to the implicit view's devicePixelRatio (or 1.0 if no view is attached), so the scene is rasterized at the same density Flutter is compositing the surrounding UI at. Pass a smaller value to trade fidelity for performance, or a larger one for supersampling.

This is the single-view convenience over renderViews.

Implementation

void render(
  Camera camera,
  ui.Canvas canvas, {
  ui.Rect? viewport,
  double? pixelRatio,
}) {
  renderViews(
    [RenderView(camera: camera)],
    canvas,
    region: viewport,
    pixelRatio: pixelRatio,
  );
}