Run Flutter on Multiple Devices Simultaneously

2022-02-16T00:00:00.000Z

How do you run a Flutter app on multiple devices at once? The simplest way to run on all connected devices at once is to use the command

flutter run -d all 

This will start the app and on all the devices at once. This includes physical devices connected via USB and any emulators that are currently running.

** Debugging on Multiple Devices at Once **

Flutter makes it easy to debug on multiple devices at the same time.

Firstly list all your devices

flutter devices

Which shows something like this

Nexus 5X (mobile)            • 025919cb854aa4a8 • android-arm64  • Android 8.1.0 
Nexus 5X (mobile)            • 02653aa0664fbb46 • android-arm64  • Android 8.1.0 
AOSP on IA Emulator (mobile) • emulator-5554    • android-x86    • Android 9 
Windows (desktop)            • windows          • windows-x64    • Microsoft Windows 
Chrome (web)                 • chrome           • web-javascript • Google Chrome 98.0.4758.102
Edge (web)                   • edge             • web-javascript • Microsoft Edge 98.0.1108.50


Then edit or create a ** .vscode\launch.json** file and make it look something like this

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "lane_timer",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "lane_timer (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "Dev1",
      "request": "launch",
      "type": "dart",
      "deviceId": "025919cb854aa4a8"
    },
    {
      "name": "Dev2",
      "request": "launch",
      "type": "dart",
      "deviceId": "02653aa0664fbb46"
    },
    {
      "name": "Host",
      "request": "launch",
      "type": "dart",
      "deviceId": "emulator-5554"
    }
  ],
  "compounds": [
    {
      "name": "Multiple Devices",
      "configurations": ["Host", "Dev1", "Dev2"]
    }
  ]
}

Each device can be stopped, started or hot reloaded independently.