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.

In WebAssembly builds, Chromium-based browsers prefer skwasm and other browsers fall back to CanvasKit; 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 default renderer for web builds. Compared to skwasm, it is significantly faster at exchanging byte buffers between JavaScript and Dart, which Flet apps do on every UI update.

SKWASMclass-attributeinstance-attribute

Uses the skwasm renderer.

skwasm is available for WebAssembly web builds and can provide better rendering performance, at the cost of slower byte-buffer exchange across the JavaScript/Dart boundary. 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)