'Create a Flutter module for desktop apps

Currently, when running the command flutter create -t module --org com.example app we are able to generate a Flutter module which we can add to a host parent app. The command though only supports it for mobile (Android and iOS). I need to do something similar with windows and macos desktop apps since Flutter supports those platforms as well and I have existing desktop apps that I'd like to augment with Flutter UI. Is it currently not possible to do so? Is there a workaround as to how to get a Flutter module to be hosted by a parent desktop app?

For reference, this is the documentation for adding a module https://docs.flutter.dev/development/add-to-app



Solution 1:[1]

I can launch a flutter View Contorller by following step. Mabye this way is much like using Flutter module for mobile.

Step 1. Create a Flutter desktop project.

Step 2. Build your Flutter project. and you can get App.framework and FlutterMacOS.framework.

Step 3. Add those frameworks to your project. enter image description here

Step 4. Add FlutterViewController like Flutter module for mobile. enter image description here

Step 5. Make sure add sandbox connections privilege. Otherwise dart vm would print an error. enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ziming Su