Flet
Flet is a framework that enables you to easily build realtime web, mobile and desktop apps in your favorite language and securely share them with your team. No frontend experience required.
⚡From idea to app in minutes
An internal tool or a dashboard for your team, weekend project, data entry form, kiosk app or high-fidelity prototype – Flet is an ideal framework to quickly hack a great-looking interactive apps to serve a group of users.
📐 Simple architecture
No more complex architecture with JavaScript frontend, REST API backend, database, cache, etc. With Flet you just write a monolith stateful app in Python only and get multi-user, realtime Single-Page Application (SPA).
🔋Batteries included
To start developing with Flet, you just need your favorite IDE or text editor. No SDKs, no thousands of dependencies, no complex tooling – Flet has built-in web server with assets hosting and desktop clients.
Powered by Flutter
Flet UI is built with Flutter , so your app looks professional and could be delivered to any platform. Flet simplifies Flutter model by combining smaller “widgets” to ready-to-use “controls” with imperative programming model.
🌐 Speaks your language
Flet is language-agnostic, so anyone on your team could develop Flet apps in their favorite language. Python is already supported, Go, C# and others are coming next .
📱 Deliver to any device
Deploy Flet app as a web app and view it in a browser. Package it as a standalone desktop app for Windows, macOS and Linux. Install it on mobile as PWA or view via Flet app for iOS and Android.
Flet app example
At the moment you can write Flet apps in Python and other languages will be added soon.
Here is a sample “Counter” app:
import flet
from flet import IconButton, Page, Row, TextField, icons
def main(page: Page):
page.title = "Flet counter example"
page.vertical_alignment = "center"
txt_number = TextField(value="0", text_align="right", width=100)
def minus_click(e):
txt_number.value = int(txt_number.value) - 1
page.update()
def plus_click(e):
txt_number.value = int(txt_number.value) + 1
page.update()
page.add(
Row(
[
IconButton(icons.REMOVE, on_click=minus_click),
txt_number,
IconButton(icons.ADD, on_click=plus_click),
],
alignment="center",
)
)
flet.app(target=main)
To run the app install flet module:
pip install flet
and run the program:
python counter.py
The app will be started in a native OS window – what a nice alternative to Electron!
Now, if you want to run the app as a web app, just replace the last line with:
flet.app(target=main, view=flet.WEB_BROWSER)
run again and now you instantly get a web app:
Getting started
Sample apps in Python
Contribute or download this package source code on GitHub
Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required. https://github.com/flet-dev/flet 598 forks. 15,002 stars. 380 open issues. Recent commits: Fix running the app on Android 10 (#5909)* Fix concurrency issue in session update processingCopies pending updates and effects to local lists before processing and clears the original sets early. This prevents potential issues if new updates or effects are added during iteration.* Register signal handlers only when not embeddedWrapped signal handler registration in a check for embedded mode using is_embedded(). This prevents signal handlers from being set when the app is running in an embedded environment.* Improve socket server connection handling and cleanupRefactored FletSocketServer to better manage concurrent connections, ensuring proper cleanup and termination of previous connections using locks and connection tokens. Enhanced the send and receive loops to prevent race conditions and resource leaks, and updated the Dart client to use the 'tcp://' protocol in debug mode.* Remove async disconnect with timeout for session closeEliminated the asynchronous disconnect call with a timeout when closing a session. Now only the synchronous close method is called, simplifying error handling during session cleanup. , GitHub feat: add py.typed marker file for PEP 561 support (#5855) , GitHub Audio dispose fix (#5893)* Add resource cleanup in audio and component classesDispose of the audio player in AudioService and clear hooks in Component on unmount to ensure proper resource management and prevent potential memory leaks.* Refactor flashlight service to remove custom exceptionsRemoved custom exception classes and error handling from the flet-flashlight Python and Dart implementations. The Flashlight service methods now directly invoke platform methods without raising or returning custom errors. Updated example usage and cleaned up related imports and documentation.* Rename Flashlight methods to 'on' and 'off'Changed method names from 'turn_on' and 'turn_off' to 'on' and 'off' in the Flashlight class and updated example usage accordingly for consistency and brevity.* Await clipboard setData operationAdded 'await' to Clipboard.setData in ClipboardService to ensure the operation completes before proceeding. This improves reliability when setting clipboard data asynchronously.* Replace ElevatedButton with Button in exampleUpdated the flashlight example to use ft.Button instead of ft.ElevatedButton for consistency or UI preference.* Remove Flashlight exception docs and nav entriesDeleted documentation files for Flashlight exception classes and removed their references from the mkdocs navigation and the index page. This streamlines the documentation by eliminating detailed exception class pages for Flashlight. , GitHub Owen/control docs p8 (#5887)* add navigation bar example tests and images* add menuitembutton example tests and images* add menu bar example tests and images* add list view example tests and images* unccoment menu bar test* add pixel_ratio parameter to screenshots, fix navigation bar width* change submenu example width* add cupertino timer picker example tests and images* update navigation bar and badge golden images , GitHub New services: `Accelerometer`, `Barometer`, `Battery`, `Connectivity`, `Gyroscope`, `Magnetometer`, `Share`, `ScreenBrightness`, `UserAccelerometer`, `Wakelock` (#5846)* Add sensor services and events to FletIntroduced support for device sensors including accelerometer, user accelerometer, gyroscope, magnetometer, and barometer. Added corresponding Dart services, Python control classes, event types, and documentation. Updated mkdocs navigation and provided example usage for each sensor.* Refactor sensors service imports and formattingAdded import for numbers utility in sensors.dart and improved code formatting for error handling and debug print statements.* Update PyPI cleanup script and add module supportChanged the version exclusion regex and added cleanup commands for multiple flet modules to the clean-pypi.sh script to ensure all related packages are properly cleaned from PyPI.* Update sensors_plus to version 7.0.0Bump sensors_plus dependency from 6.1.1 to 7.0.0 in pubspec.yaml and update pubspec.lock accordingly for compatibility with the latest package features and fixes.* Add services property to BasePage and ViewIntroduces a services property to BasePage and View, allowing management of Service controls via property accessors. The services attribute is now stored in View and proxied through BasePage, improving encapsulation and flexibility.* Refactor sensor examples and update service docsSensor example scripts now use `page.services` and `page.controls` instead of session store and `page.add`. Documentation for sensor services was updated for clarity, platform support, and iOS requirements, including details on `NSMotionUsageDescription` for barometer usage.* Fix and clarify docstrings and references in controlsCorrected docstring references and improved clarity in several control modules. Updated links to use correct attribute names and fixed formatting in flet_map/types.py, cupertino_switch.py, snack_bar.py, and types.py.* Add ScreenBrightness service and Python bindingsIntroduces ScreenBrightnessService in Dart and ScreenBrightness control in Python, enabling control and observation of system and application screen brightness. Updates plugin registrants for macOS and Windows, adds documentation and example usage, and includes the screen_brightness dependency in pubspec.yaml.* Update screen brightness docs and clarify platform supportFixed example path in ScreenBrightness docs, added documentation for ScreenBrightnessChangeEvent, and updated mkdocs navigation. Clarified that accelerometer, gyroscope, and user accelerometer services are only supported on Android and iOS (not web). Expanded ScreenBrightness docstring with platform notes and Android permission instructions.* Add Wakelock service to Flutter and Python SDKsIntroduced a new Wakelock service to prevent device sleep in both the Flutter and Python Flet SDKs. Added the wakelock_plus dependency to the Flutter project, implemented the WakelockService in Dart, and exposed the Wakelock control in Python with documentation and an example. Updated documentation and navigation to include the new control.* Update package_info_plus and wakelock_plus dependenciesBump package_info_plus to version 9.0.0 in client with an override, and update wakelock_plus to 1.4.0 in both client and flet package. This ensures compatibility with the latest versions and resolves potential dependency conflicts.* Update wakelock_plus and add new dependenciesDowngraded wakelock_plus to v1.2.8 in packages/flet and added wakelock_plus v1.4.0 and package_info_plus v9.0.0 to client dependencies. This ensures compatibility and provides additional functionality in the client package.* Add Battery service support to FletIntroduces Battery service integration in Flet, including Dart and Python implementations, documentation, and example usage. Updates plugin registrants for macOS and Windows, adds battery_plus dependency, and exposes Battery-related types and events in the Python SDK.* Add connectivity service and documentationIntroduced Connectivity service in both Dart and Python SDKs, enabling connectivity status checks and change notifications. Registered connectivity_plus plugin for macOS and Windows clients, updated dependencies, and added example usage and documentation for the new service.* Add and improve docstrings for service controlsAdded and enhanced docstrings for classes and methods in battery, browser_context_menu, clipboard, connectivity, service, shared_preferences, storage_paths, and url_launcher modules to improve code documentation and clarity for developers.* Add Share service and Python API for sharingIntroduces ShareService in Dart and integrates share_plus for sharing text, links, and files. Adds Python API (Share, ShareFile, ShareResult, etc.), documentation, and example usage. Updates plugin registration and dependencies for macOS and Windows.* Rename CupertinoActivityType to ShareCupertinoActivityTypeReplaces the CupertinoActivityType enum with ShareCupertinoActivityType throughout the codebase for clarity and consistency. Updates documentation, mkdocs navigation, and references in __init__.py and share.py. Adds docstrings and improves type annotations for share-related classes and methods.* Refactor docs: move service-related files and update navigationService-related documentation files were moved from 'controls' and 'types' to a new 'services' directory. The mkdocs navigation was updated to reflect this change, grouping all service docs under a new 'Services' section. Macros and overview rendering were refactored to support both controls and services navigation. Minor cleanup in page.dart and macro Python files.* Add API Reference and Types docs, update nav structureIntroduces new API Reference and Types index documentation pages. Updates mkdocs.yml to include these sections in the navigation, providing better structure and discoverability for API and type documentation. Minor wording improvements in the cookbook index.* Add cookbook overview macro and generalize nav renderingIntroduced a new `cookbook_overview` macro for generating a dynamic overview list in the cookbook docs. Refactored and generalized the navigation rendering logic in `controls_overview.py` to support arbitrary nav paths, base directories, and skip paths, enabling reuse for different documentation sections. Updated the cookbook index to use the new macro and improved the API reference and cookbook index content.* Move examples from controls to services directoryRenamed Python example files and related media from sdk/python/examples/controls to sdk/python/examples/services for consistency. Updated references in documentation and README files to point to the new services paths. Adjusted code comments and doc macros to reflect the new structure.* Add basic examples and update docs for servicesAdded basic usage examples for BrowserContextMenu, Clipboard, SharedPreferences, and StoragePaths services in the examples directory. Updated corresponding documentation files to include example code and improved structure for better clarity.* Enhance UrlLauncher with launch modes and configurationAdded support for multiple launch modes, in-app web view and browser view configurations, and popup window opening in UrlLauncher for both Dart and Python SDKs. Updated documentation and examples to reflect new features and usage. Exposed BrowserConfiguration, LaunchMode, and WebViewConfiguration in Python package exports and docs.* Refactor service registry usage in Page controlConsolidated service registries in the Page control by removing separate _user_services and _page_services in favor of a single _services property. Updated related Dart and Python code, including tests and service registration logic, to reflect this change. Deprecated direct service properties on Page in favor of using service classes directly.* Update commented key from _user_services to _servicesChanged a commented dictionary key in test_object_diff_in_place.py from '_user_services' to '_services' for consistency with the underlying code or data structure.* Update Flutter dependencies to latest versionsUpgraded battery_plus to 7.0.0, connectivity_plus to 7.0.0, device_info_plus to 12.3.0, and screen_brightness to 2.1.7 in packages/flet/pubspec.yaml. This ensures compatibility with the latest features and bug fixes from these packages.* Add file sharing from path exampleIntroduces a new function to share files from a file path, including UI updates to provide separate buttons for sharing files from bytes and from paths. File sharing from paths is disabled on the web platform.* Set pixel_ratio in outlined button screenshot testsUpdated screenshot assertions in the handling_clicks test to specify the pixel_ratio parameter, ensuring screenshots are taken with the correct scaling.* Remove duplicate and redundant code in Flet packageEliminated a duplicate line in the ShareFile documentation, removed a repeated entry for 'BrowserConfiguration' in __all__, and simplified the ServiceRegistry default_factory in Page control. These changes improve code clarity and maintainability.* Refactor sensor services and event modelsSplit sensor services into individual Dart files and refactor base class for sensor streams. In Python, move sensor event models into their respective service modules, update event timestamp types to datetime, and remove the shared sensor_events.py file. Update imports and public API accordingly for improved modularity and clarity.* Refactor sensor example apps to use page.add and appendUpdated sensor service example scripts to use page.add for UI controls and page.services.append for service registration, replacing previous usage of page.controls and assignment to page.services. Also removed unnecessary variable declarations and logging setup for improved clarity and consistency.* Refactor connectivity API and add platform checksRenamed connectivity methods and event handlers for consistency (e.g., 'check_connectivity' to 'get_connectivity', 'on_connectivity_change' to 'on_change'). Updated enum name from ConnectivityResult to ConnectivityType. Added platform support checks to sensor and service classes, raising FletUnsupportedPlatformException on unsupported platforms. Improved documentation to clarify supported platforms for each service.* Replace ConnectivityResult with ConnectivityType in docsRemoved the documentation for ConnectivityResult and added documentation for ConnectivityType. Updated mkdocs.yml navigation to reference ConnectivityType instead of ConnectivityResult. , GitHub
Provides the list of the opensource Flutter apps collection with GitHub repository.