Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add Platforms to an Existing Flutter App/Project?

Tags:

flutter

I created a Flutter app with mobile support only:

flutter create --platforms=ios,android foo

I also have another Flutter project that I created before web was supported by Flutter, which is why it only contains support for mobile.


Now, I want to run my app on web and macOS, but I receive the following error when trying to use flutter run -d macos:

Exception: No macOS desktop project configured. See https://flutter.dev/desktop#add-desktop-support-to-an-existing-app to learn about adding macOS support to a project.
like image 626
creativecreatorormaybenot Avatar asked Feb 15 '21 19:02

creativecreatorormaybenot


People also ask

How do I add a platform to my Flutter project?

flutter create . You can simply run this from the root of your Flutter project and it will add the required files for all platforms. If you only want to add support for specific enabled platforms, you can do that by supplying the --platforms argument: flutter create --platforms=web,macos .

How do I integrate a Flutter into an existing app?

Using the File > New > New Module… menu in Android Studio in your existing Android project, you can either create a new Flutter module to integrate, or select an existing Flutter module that was created previously. If you create a new module, you can use a wizard to select the module name, location, and so on.

How do you add dependency in Flutter?

You can go to the pubspec. yaml file and add dependencies ,under dependencies and then packages get will do the work. or you can run flutter pub get in the terminal.


1 Answers

You can add support for new plugins by recreating your project:

flutter create .

You can simply run this from the root of your Flutter project and it will add the required files for all platforms.


If you only want to add support for specific enabled platforms, you can do that by supplying the --platforms argument:

flutter create --platforms=web,macos .
like image 112
creativecreatorormaybenot Avatar answered Oct 17 '22 10:10

creativecreatorormaybenot