I want to run my flutter app on web and in emulator simultaneously in VS Code.
But I am only able to run it in either web or emulator one by one but not simultaneously.
-
You can try opening two VS Code instances, would that do the trick?Phake– Phake2021-03-03 16:37:36 +00:00Commented Mar 3, 2021 at 16:37
Add a comment
|
1 Answer
You can create a compound launch config in your .vscode/launch.json that launches two configs that each specify a deviceId.
This one creates three configs, one to launch on the current device (shown in the status bar), one to launch on iOS, and one to launch on Android. It then creates a compound config that will launch on iOS and Android devices at the same time. You can change one of the device IDs to chrome to launch on Chrome.
{
"version": "0.2.0",
"configurations": [
{
"name": "Current Device",
"request": "launch",
"type": "dart"
},
{
"name": "Android",
"request": "launch",
"type": "dart",
"deviceId": "android"
},
{
"name": "iPhone",
"request": "launch",
"type": "dart",
"deviceId": "iphone"
},
],
"compounds": [
{
"name": "All Devices",
"configurations": ["Android", "iPhone"],
}
]
}
More info can be found on the Flutter wiki.