A prebuilt Dart SDK is available for IDE consumption at: //third_party/dart/tools/sdks/<linux|mac>/dart-sdk
. Note that this SDK is sometimes a few days behind the version of //third_party/dart
. If you require an up-to-date SDK, one gets built with Fuchsia at: //out/<build-type>/dart_host/dart-sdk
.
Download and install Visual Studio Code
[optional] Setup VS Code to launch from the command line
For Macs: To allow running VS Code from the terminal using the code
command, follow the instructions here
For Linux and Windows: This should already be done as part of the installation
Install the following extensions:
Here are some helpful user settings for Dart, you can open your user settings by typing Ctrl+,
:
{ // Auto-formats your files when you save "editor.formatOnSave": true, // Don't run pub with fuchsia. "dart.runPubGetOnPubspecChanges": false, // Settings only when working in Dart "[dart]": { // Adds a ruler at 80 characters "editor.rulers": [ 80 ], // Makes the tab size 2 spaces "editor.tabSize": 2, }, }
If you find that the IDE is unable to find imports (red squigglies) that are already correctly in your BUILD.gn dependencies, this is usually a sign that Dart analysis is not working properly in your IDE.
When this happens, try the following:
Delete //out
and rebuild. Specifically, a release build overrides a debug build. This means that if you have a broken release build, any release build overrides a debug build. With a broken release build, no amount of correct rebuilding on debug will solve the issue until you delete //out/release-x64
.
.packages
and pubspec.lock
files in your project (if present)."dart.runPubGetOnPubspecChanges": false,
is present in your VSCode preferences to prevent the files from reappearing whenever a pubspec.yaml
file is edited.