- 1 year ago
How to set this command "flutter run -d chrome --web-renderer html" to run as default on VSCode?
To set the command "flutter run -d chrome --web-renderer html" as the default launch configuration in Visual Studio Code for your Flutter project, you can follow these steps:
Open your Flutter project in Visual Studio Code.
Go to the Run view by clicking on the bug icon in the left sidebar, or by using the shortcut
Ctrl + Shift + D
(Cmd + Shift + D
on macOS).Click on the gear icon on the top right corner of the Run view and select "Open Configurations."
In the
.vscode
folder, locate thelaunch.json
file. If it doesn't exist, click on the "Create a launch.json file" link and select the appropriate environment (e.g., "Dart & Flutter").Inside the
configurations
array, add a new configuration object with the following content:json{
"name": "Flutter Web - Chrome",
"request": "launch",
"type": "dart",
"program": "lib/main.dart",
"args": ["run", "-d", "chrome", "--web-renderer", "html"],
"flutterMode": "debug"
}
Save the
launch.json
file.
Now, when you click the Run button in Visual Studio Code or use the shortcut F5
, it will run the Flutter project using the command "flutter run -d chrome --web-renderer html" on the Chrome device.
Make sure you have the Flutter and Dart extensions installed in Visual Studio Code for the best Flutter development experience.