Getting Started#
This guide walks you through creating your first Flet extension package.
Prerequisites#
- Python 3.11+
- uv (recommended) or pip
Installation#
Or with pip:
Creating your first extension#
1. Run the create command#
You'll be prompted for:
- Extension type — Auto-detect (recommended), Service (non-visual), or UI Control (visual widget)
- Flutter package name — the pub.dev package you're wrapping (e.g.
onesignal_flutter) - Extension name — auto-derived, e.g.
flet-onesignal - Python package name — auto-derived, e.g.
flet_onesignal - Control class name — auto-derived, e.g.
Onesignal - Description and Author
Auto-detect
When you choose Auto-detect, flet-pkg downloads the Flutter package and inspects the Dart source code to determine whether it contains widgets (UI Control) or only services. This is the recommended option if you're unsure which type to pick.
Name conflict detection
After you enter the extension name, flet-pkg checks PyPI, GitHub, and the official Flet SDK monorepo (flet-dev/flet) for existing packages with the same name. If matches are found, links are displayed and you can choose whether to continue.
2. Navigate to your project#
3. Install dependencies#
4. Run tests#
Name derivation#
flet-pkg automatically derives names from the Flutter package name:
| Flutter package | Project name | Python package | Class name |
|---|---|---|---|
onesignal_flutter |
flet-onesignal |
flet_onesignal |
Onesignal |
flutter_map |
flet-map |
flet_map |
Map |
google_maps_flutter |
flet-google-maps |
flet_google_maps |
GoogleMaps |
Common Flutter affixes (flutter_, _flutter, _plus, _pro) are stripped automatically.
What's next#
- Edit the Python control file in
src/<package_name>/to implement your Flet control - Edit the Dart service/widget in
src/flutter/<package_name>/lib/src/ - Add examples in
examples/ - Run
flet-pkg --helpfor all available options