Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Debug using Flutter Flavor?

I'm trying to run the debug mode on visual studio code (click "run and debug") for my flutter app, but when I do I'm facing the following issue:

The Xcode project defines schemes: release, private.

Exception: You must specify a --flavor option to select one of the available schemes.

So I have these two "flavours" but I'm not sure how to specify which to use. Normally, running the app through the terminal would require me to specify it as such: flutter run --flavor private but I'm not sure how to do the same for debug. Is there an equivalent command for debug mode?

Would appreciate some help, thanks in advance!

like image 779
someJoe121 Avatar asked Mar 09 '26 22:03

someJoe121


1 Answers

This answer will only be what you're looking for if you created your flavors (and schemas) correctly (check this for reference: Flavors in Flutter by Flutter Explained channel) and if you are using android studio, since it is there were I solved it.

After having followed the video or any other correct explanation or set of steps, it is true that you cannot run the debugger nor have any of the DevTools attached if you run your app through a command. For example in my case, one of my flavors is named 'staging' so the command I ran would be:

flutter run --flavor staging -t lib/main_staging.dart

But by doing so, yes, you can run your app, but you won't see any of the previously mentioned tools attached. What I did (and this is the answer) is this:

enter image description here

and then added the additional args (in my case I wanted to run the 'staging' flavor or schema, as you already may have noticed) so:

enter image description here

After that, I got rid of this exception

Exception: You must specify a --flavor option to select one of the available schemes.

That is: the exception did not show again when hitting either one of these two buttons ('Run' or 'Debug'):

enter image description here

And that would be it. After that, I was able to see the debugger working as well as the DevTools.

like image 159
Iván Yoed Avatar answered Mar 12 '26 15:03

Iván Yoed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!