IDEs

Dart SDK

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.

Visual Studio Code

  1. Download and install Visual Studio Code
  2. [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

  3. Install the following extensions:
    • Dart Code: Support for programming in Dart
    • FIDL language support: Syntax highlighting support for Fuchsia's FIDL files
    • GN: Syntax highlighting for GN build files
    • Optional but helpful git extensions:
  4. 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,

  // 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,
    },
}

Troubleshooting

When you find the Dart analysis is not working properly in your IDE, 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.
  • Delete the .packages file in your project and rebuild.
  • Reboot your machine. (This has sometimes fixed the issue.)