Flutter profiles in VSCode (Product flavors)

Jonas De Vrient
May 12 · 2 min read

VSCode provides a simple way to create and run your custom Flutter configurations. We could add configurations for the default Flutter run builds for debug, profile and release, but imagine having different product flavors like a free and a pro version.

Example of the Flutter configurations for the different product flavors

A thing you should know

In this example there are already different product flavors in your Flutter project, more info about flavor builds on flutter.dev. In this article there will be two product flavors a free and a pro version of an application. In this example app there are two main files: main.dart and main_pro.dart. These are optional, it depends if the pro version of the app uses e.g. another main widget.

Ready, set and 🏃

  1. Open your Flutter project in VSCode and create (if not made already) a launch.json file in the .vscode folder.
    This file will contain our Flutter configuration for VSCode.
  2. The configuration is a json object so start by creating a json object with the required fields version and configurations.
  3. In the first Flutter configuration we will define the free version of the app.
    Add an object with the following properties: name(will be displayed in VSCode as configuration name), request, type, and last args (will use the flavor flag in flutter run).
  4. As last we will add the pro version in our configurations, it is simular to the free configuration, the only difference is that the program argument is added, this will specify which main file flutter should use to build.

✅ The result

It’s simple as that. Open the debug panel in VSCode (ctrl + shift + D).
Enjoy your custom Flutter configurations in the top bar. You can select one and it will run that configuration on your attached device or emulator.

Your configurations in VSCode

Still struggling?

I hope this article was helpful, if it is not working like it should, don’t hesitate to contact me and I’ll try to help.
If you happy and you know it 👏 your hands!

Did I make some mistakes or typos? Comment down below and I’ll fix them!

Jonas De Vrient

Written by

Student — Flutter enthusiast

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade