Skip to content

flet-webview#

pypi downloads license

A Flet extension for displaying web content in a WebView.

It is based on the webview_flutter and webview_flutter_web Flutter packages.

Platform Support#

This package supports the following platforms:

Platform Supported
Windows
macOS
Linux
iOS
Android
Web

Usage#

Installation#

To install the flet-webview package and add it to your project dependencies:

uv add flet-webview
pip install flet-webview  # (1)!
  1. After this, you will have to manually add this package to your requirements.txt or pyproject.toml.
poetry add flet-webview

Example#

main.py
import flet as ft

import flet_webview as fwv


def main(page: ft.Page):
    page.add(
        fwv.WebView(
            url="https://flet.dev",
            on_page_started=lambda _: print("Page started"),
            on_page_ended=lambda _: print("Page ended"),
            on_web_resource_error=lambda e: print("WebView error:", e.data),
            expand=True,
        )
    )


ft.run(main)