Introducing Flet
Flet is an innovative framework designed to help developers effortlessly create real-time web, mobile, and desktop applications in their preferred programming languages. One of the standout features of Flet is that it enables users to share applications securely with their teams, all without needing any prior experience in frontend development.
⚡ Rapid App Development
Flet allows developers to transform their ideas into fully functioning applications within minutes. Whether it’s an internal tool, a dashboard, a weekend project, a data entry form, a kiosk application, or a high-fidelity prototype, Flet serves as an excellent framework for quickly crafting interactive applications that cater to a group of users.
📐 Simplified Architecture
Unlike traditional development approaches that require complex systems involving a JavaScript frontend, REST API backend, databases, and caching systems, Flet offers a simplified architecture. With Flet, developers can write a single, stateful application using only Python, resulting in a multi-user, real-time Single-Page Application (SPA).
🔋 Inclusive Development Environment
Flet offers a development environment with fewer complications. Developers only need their preferred Integrated Development Environment (IDE) or text editor to start building applications. Unlike other platforms that require multiple Software Development Kits (SDKs), along with numerous dependencies and complicated tools, Flet provides a built-in web server for serving assets along with desktop clients.
Backed by Flutter
The user interfaces in Flet are powered by Flutter. This ensures that applications developed on Flet are professional in appearance and can be delivered across various platforms. Flet simplifies the Flutter development model by combining smaller "widgets" into larger, ready-to-use "controls" that operate under an imperative programming model.
🌐 Language Flexibility
Flet is language-agnostic, meaning it allows team members to build applications using the programming language they are most comfortable with. Although it currently supports Python, additional languages such as Go and C# are being integrated into future releases.
📱 Multi-Device Deployment
Applications built with Flet can be deployed as web apps accessible through a web browser. They can also be packaged as standalone desktop applications for Windows, macOS, and Linux. Additionally, Flet applications can be installed on mobile devices as Progressive Web Apps (PWAs) or accessed via the Flet app on iOS and Android devices.
Example Application: Flet Counter App
Here’s a simple example using Python to build a basic counter application with Flet. Below is a snippet illustrating how easy it is to create a counter where users can increase or decrease a number:
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 = str(int(txt_number.value) - 1)
page.update()
def plus_click(e):
txt_number.value = str(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 execute the app, one needs to install the flet
module using:
pip install flet
Then run the program with:
python counter.py
This code initiates the application in a native OS window, providing a more streamlined alternative to Electron.
To convert this into a web app, the last line is modified as follows:
flet.app(target=main, view=flet.AppView.WEB_BROWSER)
Getting Started with Flet
Here are some resources for getting started with Flet:
Sample Applications in Python
Flet provides several example applications to inspire and guide developers, including:
Further inspirational demo applications are available in the gallery.
Joining the Flet Community
For discussions, support, and updates, join the growing Flet community:
Contributing to Flet
Interested in contributing to the Flet project? You can find more information in the CONTRIBUTING.md file.