Skip to main content

WebRenderer

Selects which Flutter web renderer should be used for a web-hosted app.

Use this with the web_renderer argument of run or run_async.

Note

The available renderer choices depend on how the web frontend was built. A default web build provides CanvasKit. A WebAssembly build can make both CanvasKit and skwasm available.

Inherits: enum.Enum

Properties

  • AUTO - Lets the runtime choose the renderer automatically.
  • CANVAS_KIT - Uses the CanvasKit renderer.
  • SKWASM - Uses the skwasm renderer.

Properties

AUTOclass-attributeinstance-attribute

Lets the runtime choose the renderer automatically.

This is the recommended default. In WebAssembly builds, the runtime can prefer skwasm and fall back to CanvasKit when needed. In default web builds, CanvasKit is used.

CANVAS_KITclass-attributeinstance-attribute

Uses the CanvasKit renderer.

CanvasKit is broadly compatible with modern browsers and is the renderer used by default in standard web builds.

SKWASMclass-attributeinstance-attribute

Uses the skwasm renderer.

skwasm is available for WebAssembly web builds and can provide better startup time and frame performance. Browsers and servers must meet the requirements for WebAssembly support, and multi-threaded rendering additionally requires the necessary SharedArrayBuffer security setup.

Usage Example

You can explicitly set what renderer to use when running a Flet program in web mode using the web_renderer parameter of the ft.run.

import flet as ft

def main(page: ft.Page):
...

ft.run(main, view=ft.AppView.WEB_BROWSER, web_renderer=ft.WebRenderer.CANVAS_KIT)