Open
Description
Why re-rewrite?
- Technical debt. Wrong architecture. The first version of Flet was born from Pglet which was web-based framework and with a promise to support any language. That influenced the design of Flet. Flet, on other hand, is a Python-only framework targeting all platforms, not just web.
- Improve experience for both Flet app developers and Flet extension developers.
- Simplify maintenance of a rapidly growing code base.
- It is easier to rewrite and break now, pre 1.0, when user base is relatively small.
How?
- Simplify controls implementation on Python side: dataclasses with automatic constructors and properties, no more unnecessary conversions to/from strings or JSON, built-in support for properties of complex types (dataclasses), enums. Strongly-typed event handlers. Easier to add new controls and zero maintenance of existing.
- Docstrings for all Flet controls with auto-generated Docusaurus docs.
- New diffing algorithm optimized for imperative and declarative Flet app styles.
- Replace Redux library on Dart side with InheritedWidget and Provider. Hierarchical data structure reflecting Python control tree.
- Binary serialization protocol between Python and Dart. Less traffic for tree update operations and no base64 for passing binary data. On Dart side control properties have the same name as Python class properties.
New features
- Single-threaded UI model. CPU-bound operations must be run in threads wrapped into asyncio tasks.
- Auto-update is enabled by default. No need to call
.update()
in the most cases. - Declarative approach. [Article]
- ToDo example, key patterns/concepts, basic template.
key
property
- Services - non-visual persistent "controls" that don't yield any UI widgets. Audio, Clipboard, FilePicker - just to name a few - are now services. [Article]
- Improved extensibility (Extension class).
- Web:
- WASM support [Sample with page.wasm]
- "No CDN" support for offline web apps (v1: Add
--no-cdn
option (full offline support) toflet build
,flet run
andflet publish
flet#5257) - Multiple FletApp controls in web mode with "script" as argument [Sample - FletPad?].
- Multi-View - embedding Flet web app into existing web page (v1: Web Multi-View - embedding Flet web app into existing web page flet#5274).
before_main
hook (v1: Web Multi-View - embedding Flet web app into existing web page flet#5274)
Breaking changes
- Control IDs are integers now.
- FilePicker API re-worked.
- Services: [list]
- V1 breaking changes flet#5238
Other changes and improvements
- Migrated from Poetry to uv.
Fixes
- LineChart animation for beautiful dashboards. [Sample]
Metadata
Metadata
Assignees
Labels
No labels