CHROME_EXECUTABLE
in VS Code for Dart/Flutter DevelopmentThe Dart/Flutter extension in VS Code couldn’t detect Chrome, even after setting CHROME_EXECUTABLE
in the system environment variables or shell config (e.g., .bashrc
or .zshrc
).
To ensure the Dart extension recognizes Chrome, add CHROME_EXECUTABLE
directly to VS Code’s Dart-specific environment settings:
Open VS Code Settings (Ctrl + ,
or Cmd + ,
).
Search for "dart.env".
Click "Edit in settings.json".
Add the following configuration:
{
"dart.env": {
"CHROME_EXECUTABLE": "/opt/google/chrome/chrome"
}
}
Replace /opt/google/chrome/chrome
with your Chrome path if different (e.g., /usr/bin/google-chrome
on some Linux systems).
Restart VS Code for changes to take effect.