Search code examples
flutterflutter-web

Setup launch.json file for Flutter web using local Flutter version


I have installed Flutter in my mac inside my root folder: /[root]/flutter and I use it on project A.

Now I need to use a different version of Flutter for project B (flutter web), so I cloned Flutter inside project B's root directory. I know that to run it, I have to launch ./flutter/bin/flutter run but how can I setup launch.json for VScode?

Here is my launch.json file:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Web",
      "type": "dart",
      "request": "launch",
      "deviceId": "chrome",
      "args": [
        ??
      ]
    },
  ]
}

I think that if I use it, then it will use the standard Flutter in my mac root and not the Flutter inside the project folder. How can I edit the launch in a way that if I click on the play button in VScode then it will run ./flutter/bin/flutter run?

I'm not interested to use tools like FVM


Solution

  • Open command palette, enter Preferences: Open User Settings.

    Search Flutter Sdk Paths. Add additional flutter sdk from there.

    Open flutter project. Do Flutter: Change SDK in the command palette.