flet icon indicating copy to clipboard operation
flet copied to clipboard

bug: Flet Extension Mislead

Open HappyCoder256 opened this issue 9 months ago • 1 comments

Duplicate Check

  • [x] I have searched the opened issues and there are no duplicates

Describe the bug

I have a certain extension i just made but I want to share it with the community but whe they install , they get an error that unknown control ' it includes flutter packages so I don't know how I could share it.

Code sample

Code
[Paste your code here]

To reproduce

Trying to pip install my python side locally

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS, Linux

Operating system details

Ubuntu 26

Flet version

0.28.3

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

HappyCoder256 avatar Feb 21 '26 22:02 HappyCoder256

Hi @HappyCoder256, thanks for building an extension! This is how Flet extensions work, not a bug.

A Flet extension has two halves: the Python package and the Flutter/Dart package. Your wheel contains both, but pip install alone only makes the Python half usable: the Dart half has to be compiled into the Flet client. The standard client that flet run / python main.py starts only includes Flet's built-in extensions, so any other control is shown as Unknown control: <Name>.

To share your extension:

  1. Publish it to PyPI (or a git repo) as usual.
  2. Tell your users to add it to their app's pyproject.toml and build the app:
[project]
dependencies = [
  "your-flet-extension",
  "flet>=1.0.3",
]
flet build linux   # or macos / windows / apk / ipa / web
  1. For day-to-day development on desktop they only need to build once. After that, flet run from the same directory picks up the client in build/<platform> (it prints a warning saying so), so Python changes don't need a rebuild. They only rebuild after adding or upgrading a Flutter extension.

I verified this end to end on Ubuntu 24.04 (arm64) with Flet 1.0.3: a wheel built from the extension template shows Unknown control with the standard client, and renders after flet build linux + flet run. One caveat until Flet 1.0.4 is out: flet build on a new project fails with a jni "Constant evaluation error" (#6919). Add this to the app's pyproject.toml to work around it:

[tool.flet.flutter.pubspec.dependency_overrides]
jni = "^1.1.0"

See How the desktop client is selected and Creating an Extension. Please also upgrade from 0.28.3: it uses the old extension API.

Previewing third-party extensions with plain flet run (without a build) is tracked in #5168, and web support in #6405, so I'm closing this one. Feel free to follow those issues.

ndonkoHenri avatar Oct 08 '26 05:10 ndonkoHenri