Two Flutter projects, two debugging sessions, only one Visual Studio Code instance

Mircea MATEI
3 min readDec 27, 2020

There are situations when your solution contains two mobile projects. How you manage their development/debugging unitary? If your answer is: open each project on a separate VS Code instance and debug them alternatively on the same emulator/device, then this article is for you.

We have an alternative debugging receipt for VS Code lovers. We will learn to debug two (or maybe many) Flutter projects, simultaneously in the same VS Code instance, using two(many) Android emulators.

Prerequisites:

  • VS Code installed
  • Flutter and Dart plugin installed
  • Android SDK platform-tools folder is on your PATH

Initial setup

Create a new folder vscode-flutter-double-debug. Inside, create another one named src. Inside src folder create two new Flutter projects. All these steps may be quickly completed, opening VS Code and typing in a terminal window, the following commands:

Opening a New Terminal window

Note: The Terminal window accept many shell languages. For Linux and Mac default is the $SHELL variable content. On Windows 10 default is PowerShell. If you are curious to read more on customizing Terminal, visit https://code.visualstudio.com/docs/editor/integrated-terminal. As you can see below, on Windows 10, I am using bash.

Typing command in Terminal window

Create the workspace

At this phase we have some folders containing two Flutter projects. We are needing a proper workspace, as the logical representation of the working folders and the related settings. Save the workspace as double-debug.

Make sure to be saved in the top vscode-flutter-double-debug folder.

The workspace will contain the src folder. On the Explorer window press the Add Folder button.

Select src folder and press Add.

If all the steps are completed well, the explorer window will look as the following capture.

Launch two Android devices

We assume that you are familiar with creating and launching two Android emulators. If not, google it for

Add configuration file

Switch to Debug view. Select Add Config (src) from the drop-down list

Select Dart & Flutter

The command will create a new file named launch.json. Add the following content to launch.json, taking care to the deviceId to be filled with your values:

That’s it! Happy debugging!

--

--