flet icon indicating copy to clipboard operation
flet copied to clipboard

Fix this "Creating Flet extension for existing Flutter package"

Open tamalmaity-dev opened this issue 1 year ago • 9 comments

Here, Creating Flet extension for existing Flutter package in the Document has few bugs ......

Build your app. Flet project created from extension template has examples/flet_spinkit_example folder with the example app.

When in the folder where your pyproject.toml for the app is (examples/flet_spinkit_example), run flet build command, for example, for macos: flet build macos -v

Open the app and see the new custom Flet Control:

open build/macos/flet-spinkit-example.app

Here when build then show errors...

 flet build apk       
[02:27:45] Flutter 3.27.4 installed ✅                                                    
[02:27:46] JDK installed ✅                                                               
           Android SDK installed ✅                                                       
(    ● ) Installing Android SDK...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Scripts\flet.exe\__main__.py", line 7, in <module>
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Lib\site-packages\flet\cli.py", line 11, in main
    flet_cli.cli.main()
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Lib\site-packages\flet_cli\cli.py", line 91, in main
    args.handler(args)
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Lib\site-packages\flet_cli\commands\build.py", line 616, in handle
    self.initialize_build()
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Lib\site-packages\flet_cli\commands\build.py", line 706, in initialize_build
    self.get_pyproject = load_pyproject_toml(self.python_app_path)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Lib\site-packages\flet_cli\utils\pyproject_toml.py", line 12, in load_pyproject_toml
    pyproject_toml = toml.loads(f.read())
                     ^^^^^^^^^^^^^^^^^^^^
  File "E:\All Coding Projects\Flet Python\flet-flutter\.venv\Lib\site-packages\toml\decoder.py", line 340, in loads
    raise TomlDecodeError("Unbalanced quotes", original, i)
toml.decoder.TomlDecodeError: Unbalanced quotes (line 42 column 52 char 987)

Please give a detailed and updated docs for Creating Flet extension for Flutter pacakages

tamalmaity-dev avatar Apr 02 '25 20:04 tamalmaity-dev

Hello @tamalmaity-dev Basing on the logs you've shared, you ran flet build apk which builds an apk file bundling a python flet app and flutter. If you want to build your custom control for Windows forexample, use flet build windows -v this will not package your app but it will just build the custom control for that specific platform which later you'll import in your app.

Hope this helps. Thanks.

HappyCoder256 avatar Jun 21 '25 13:06 HappyCoder256

Hello @HappyCoder256 i have same issue when i use flet build windows -v

melkouadio avatar Jul 16 '25 17:07 melkouadio

Check ur .toml file for unbalanced quotes.

Can you share your pyproject.toml file to help you quickly

HappyCoder256 avatar Jul 17 '25 16:07 HappyCoder256

@HappyCoder256 this is my pyproject.toml file code

`[project] name = "flet-barcode-example" version = "1.0.0" description = "" readme = "README.md" requires-python = ">=3.9" authors = [ { name = "Flet developer", email = "[email protected]" } ] dependencies = [ "flet-barcode", "flet>=0.28.3", ]

[tool.flet]

org name in reverse domain name notation, e.g. "com.mycompany".

Combined with project.name to build bundle ID for iOS and Android apps

org = "com.mycompany"

project display name that is used as an app title on Android and iOS home screens,

shown in window titles and about app dialogs on desktop.

product = "flet-barcode-example"

company name to display in about app dialogs

company = "Flet"

copyright text to display in about app dialogs

copyright = "Copyright (C) 2025 by MyCompany"

[tool.flet.app] path = "src"

[tool.flet.dev_packages]

flet-barcode = "...."`

melkouadio avatar Jul 21 '25 10:07 melkouadio

i used this same toml content and worked for me am using; Linux(Ubuntu) Python: 3.10 Flet: 0.28.3

Can you please share your specifications?

HappyCoder256 avatar Jul 21 '25 15:07 HappyCoder256

My specifications are

Windows(10) Python: 3.12.9 Flet: 0.28.3

melkouadio avatar Jul 21 '25 16:07 melkouadio

You have two options;

  • Use Linux to build your project
  • Downgrade your flet version to 0.27.5(stable) I think that's a bug in this latest version.

HappyCoder256 avatar Jul 25 '25 22:07 HappyCoder256

I also encountered this problem@ @FeodorFitsner

yst-one avatar Jul 28 '25 07:07 yst-one

Just change \ to \ \ and it will be fine

yst-one avatar Jul 28 '25 07:07 yst-one