Enabling desktop platform on existing flutter project with different flavors
I had the same issue with web support and flavors. To resolve this, I've used a way around with:
flutter create --org <identifier-for-one-of-the-flavors> .
e.g.
flutter create --org <com.example.flutter.staging> .
This created and made a setup for specific flavor only, with a new main
file, assets, scheme (flavor) etc. But, I've deleted all generated files except web
folder and everything works fine as before, but now with web support.
Nihad Delic
Updated on December 23, 2022Comments
-
Nihad Delic over 1 year
I am having issues with adding desktop platforms to existing projects.
I have followed their official docs on how to add macOS to the existing project. So basically you should:
- master or dev channel of flutter.
- should run
flutter create .
command
On this command, I get stuck, because we are using different flavors, and as a result, after step 2 I am getting:
[ +2 ms] The Xcode project defines schemes: APN, AppStore, Debug, Staging [ +12 ms] "flutter create" took 2,539ms. [ +6 ms] You must specify a --flavor option to select one of the available schemes.
But the thing is that command
flutter create
does not have at all this option. So ofc, runningflutter create --flavor=debug .
will not workSo the question is, does anyone know how to resolve this, and what's correct way of doing it?
-
Szepetry over 3 yearsI think you haven't maybe enabled it or something or while running you didn't select the device correctly. Watch this video, He shows how to work with cross platform applications. It works for me.
-
Nihad Delic over 3 yearsHey, thanks for the reply, but he did everything from official documentation the same as I did :) It's not working
-
Nihad Delic over 3 yearsYep, unfortunately, workaround but it's working. I would add something like
flutter create --org <com.example.flutter.staging> --platforms=macos .
so you don't need to remove unwanted files. Thanks