Member-only story
How to Run a Flutter App on Multiple Emulation Devices at the Same Time From VS Code
Boost up your productivity by visualizing your app in multiple emulation devices at the same time.
Up until now, whenever I am developing an android app on flutter. I always have this issue that I have to run different emulators one after another to visualize my app and I hate to do repeated things all the time. So I searched for a way to run multiple emulators at the same time and run my flutter app. So that I can check how my app looks on multiple devices.
It is really amazing that we can see how live changes affect multiple emulation devices at the same time. It can give a perfect idea to instantly change or update the UI in the app.
So I am not going to show you how you can set up your emulation device. I am assuming that you already set up multiple emulation devices. You can check this link to set up emulation devices.
1. Foremost run all the emulation devices you want to run your app in.
2. Now you need to know the ID of those emulation devices. You can run simply the following command on the Terminal.
flutter devices
3. Now you should do update your VS Code’s run and debug configuration file (launch.json
). You can find the file by clicking on the Run and debug button on VS Code and then clicking on the setting button. As shown in the below picture.
4. Add the following line after updating name
and deviceId
into the configurations section of launch.json
the file. As shown below image. please keep in mind I have used the names and IDs of my devices here, you should add your name and IDs of the devices.
5. Then you should create a new section in the file called compounds
As shown in the above list and add the name of your devices in the configuration
section.
If you enter all the information properly then your launch.json
the file will look more or less like the following.
Now all you have to do is to run this configuration to run the application on those devices by selecting the “All Devices” option in the drop-down Manu of RUN AND DEBUG option.
Happy coding!