Ad

Is It Possible To Add The MacOS/Windows/Linux Module To An Existing Flutter Application

i want to ask if it is possible to add the macOS/Windows/Linux module to an existing flutter project. I have developed an app where I unfortunately realized very late that this can also be used on Windows/macOS/Linux.

I thank all of you in advance for information regarding this.

Ad

Answer

There is currently no add-to-app support for desktop. However, there's nothing magic about the runner application that's made by flutter create; it's just a minimal application that hosts a Flutter view and is designed to work with Flutter's build system. There's no reason you couldn't replicate portions of it in your own application.

If you want to try, there are a few approaches you could follow:

  • Make a new Flutter application, and then move all of your existing native code into it, as well as adjusting the Flutter view code that's created by the template to fit into your application. This will allow you to use all of the normal Flutter tooling, and since Flutter is designed with the idea that the native runner is generated once and then yours to modify, as long as you don't fundamentally change the build system it should work well.
  • Reverse-engineer enough of the Flutter build process and template project to replicate it into your own project, such that your existing project looks enough like a template-created application that the Flutter tooling would work with it.
  • Make a new Flutter application that has just the Flutter portion of your application in it, then modify your current application's build process to build that app with the Flutter tools and then copy all of the necessary libraries and resources into your own application.
Ad
source: stackoverflow.com
Ad