Enabling desktop platform on existing flutter project with different flavors

Viewed 1923

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:

  1. master or dev channel of flutter.
  2. 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, running flutter create --flavor=debug . will not work

So the question is, does anyone know how to resolve this, and what's correct way of doing it?

1 Answers

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.

Related