flet-pkg

CLI tool to scaffold Flet extension packages.
Generates complete, ready-to-develop Flet extensions with Python + Flutter/Dart code, following Flet 0.80.x+ patterns.
Important: this tool does not perform miracles. ๐๐
Every Flutter package on pub.dev has its own API surface, configuration requirements, and platform-specific behaviors. Some packages expose simple method calls; others require complex initialization flows, native platform setup (Android manifests, iOS plists, Gradle/CocoaPods configuration), or callback-based architectures that don't map cleanly to Python.
It would be unrealistic to write a code generation algorithm that generalizes perfectly for every possible Flutter package. flet-pkg aims to accelerate the process by delivering significantly more than a blank skeleton โ it downloads the real Dart source, parses the public API, and auto-generates Python controls, type mappings, enum definitions, event handlers, and Dart bridge code. For service packages, this typically covers ~95% of the API surface.
However, the developer is still responsible for:
- Understanding how the original Flutter/Dart package works
- Reviewing the generated code for correctness
- Handling package-specific configurations (native platform setup, initialization flows, etc.)
- Adjusting or complementing the generated code for edge cases the pipeline could not cover
Think of flet-pkg as a smart starting point, not a finished product.
Features#
- Interactive & non-interactive modes โ guided prompts or full CLI flags
- Auto-detect extension type โ downloads the Flutter package and detects whether it's a Service or UI Control automatically
- Three extension types โ Auto-detect (recommended), Service (non-visual), and UI Control (visual widget)
- Name conflict detection โ checks PyPI, GitHub, and the Flet SDK monorepo before creating, warns if the name already exists
- Complete project scaffolding โ Python package, Flutter package, tests, docs, examples
- Smart name derivation โ automatically derives project, package, and class names from the Flutter package name
- Flet 0.80.x+ patterns โ uses
@ft.control,ft.Service,ft.LayoutControl,invoke_method, andEventHandler - AI refinement โ optional LLM-powered code improvement using the Architect/Editor pattern
- MCP Server โ expose scaffolding and analysis tools to AI agents via the Model Context Protocol
Quick install#
Or with uv:
Quick start#
This walks you through creating a new Flet extension with interactive prompts.
For non-interactive usage (auto-detect type):
Or specify the type explicitly:
With AI refinement#
Generated project structure#
flet-onesignal/
โโโ pyproject.toml
โโโ README.md
โโโ CHANGELOG.md
โโโ LICENSE
โโโ mkdocs.yml
โโโ docs/
โโโ tests/
โโโ examples/
โ โโโ flet_onesignal_example/
โโโ src/
โโโ flet_onesignal/ # Python package
โ โโโ __init__.py
โ โโโ onesignal.py # @ft.control + ft.Service
โ โโโ types.py
โโโ flutter/
โโโ flet_onesignal/ # Flutter package
โโโ pubspec.yaml
โโโ lib/
โโโ src/
โโโ extension.dart
โโโ onesignal_service.dart
Learn more#
- CLI Reference โ all flags and options
- MCP Server โ use flet-pkg from AI agents
- Architecture โ how flet-pkg works internally
- API Reference โ source code documentation
Support the Project#
If you find this project useful, consider giving it a star on GitHub and supporting its development:
Try flet-pkg today and turn any Flutter package into a Flet extension in seconds!#

Commit your work to the LORD, and your plans will succeed. Proverbs 16:3