Felix K
Felix K

Reputation: 88

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.

Upvotes: 1

Views: 1223

Answers (2)

Andres Riofrio
Andres Riofrio

Reputation: 86

First, you need to have flutter 3.0 or greater

flutter upgrade 

Second, create desktop support

flutter create --platforms=windows,macos,linux .

Upvotes: 2

smorgan
smorgan

Reputation: 21599

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.

Upvotes: 0

Related Questions