{"id":6645,"library":"flet","title":"Flet for Python","description":"Flet is a Python library for easily building interactive multi-platform apps using Flutter under the hood. It allows developers to create beautiful desktop, web, and mobile applications with pure Python, leveraging a declarative UI framework. Currently at version 0.84.0, Flet maintains a rapid release cadence, often with weekly development builds and bi-weekly stable releases.","status":"active","version":"0.84.0","language":"en","source_language":"en","source_url":"https://github.com/flet-dev/flet","tags":["GUI","UI","cross-platform","desktop","web","mobile","flutter","declarative"],"install":[{"cmd":"pip install flet","lang":"bash","label":"Install Flet"}],"dependencies":[],"imports":[{"symbol":"ft","correct":"import flet as ft"},{"symbol":"app","correct":"ft.app(target=main)"},{"note":"Most Flet components and functions are typically imported via 'import flet as ft' for consistency and easy access.","wrong":"from flet import Page","symbol":"Page","correct":"def main(page: ft.Page):"}],"quickstart":{"code":"import flet as ft\n\ndef main(page: ft.Page):\n    page.title = \"Flet Counter App\"\n    page.vertical_alignment = ft.MainAxisAlignment.CENTER\n\n    txt_number = ft.Text(\"0\", size=30)\n\n    def minus_click(e):\n        txt_number.value = str(int(txt_number.value) - 1)\n        page.update()\n\n    def plus_click(e):\n        txt_number.value = str(int(txt_number.value) + 1)\n        page.update()\n\n    page.add(\n        ft.Row(\n            [\n                ft.IconButton(ft.icons.REMOVE, on_click=minus_click),\n                txt_number,\n                ft.IconButton(ft.icons.ADD, on_click=plus_click),\n            ],\n            alignment=ft.MainAxisAlignment.CENTER,\n        )\n    )\n\nft.app(target=main)","lang":"python","description":"This quickstart demonstrates a simple counter application. It showcases basic UI components like `Text` and `IconButton`, event handling (`on_click`), and the critical `page.update()` method for refreshing the UI after state changes."},"warnings":[{"fix":"Always call `page.update()` or `control.update()` after changing properties of a UI control within an event handler or any function that modifies the page's state.","message":"After modifying any control's properties (e.g., `text_control.value = 'new_value'`), you must call `page.update()` (or `control.update()`, `view.update()`) for changes to be reflected in the UI. Forgetting this is a very common beginner mistake.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update event handlers to use `e.local_delta.x` and `e.local_delta.y` instead of `e.delta_x` and `e.delta_y`.","message":"In version 0.83.1, properties `delta_x` and `delta_y` in certain event objects (e.g., for mouse events) were replaced with `local_delta.x` and `local_delta.y`. Code relying on the old properties will break.","severity":"breaking","affected_versions":">=0.83.1"},{"fix":"Always refer to the official Flet documentation for your installed version (`flet --version`) to ensure correct API usage. Pay close attention to changelogs for breaking changes between versions.","message":"Due to rapid development, Flet's API can change frequently, especially for control properties and event signatures. Code written for one minor version might require adjustments for a newer one.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `flet-cli` is up-to-date (`pip install flet --upgrade`). If issues persist, consult the Flet GitHub issues, community discussions, or consider alternative packaging tools like PyInstaller with custom Flet hooks if available.","message":"Packaging Flet applications into standalone executables using `flet pack` can sometimes be platform-specific or encounter build issues, particularly on macOS, as noted in recent development releases.","severity":"gotcha","affected_versions":"All versions, specifically 0.84.0 and newer on macOS."}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}