Skip to content

Installation and Basic Configuration

Seth Ladd edited this page Jun 12, 2015 · 21 revisions

Prerequisite

The Dart plugin for Sublime requires a local install of the Dart SDK. To get the Dart SDK, follow the Dart SDK installation instructions.

We highly recommend using Dart SDK 1.9 or greater. If you use an earlier version of this SDK, you will not get live analysis feedback.

Installing

You can install this plugin in two ways.

Package Control (recommended)

Once you have Package Control installed, follow these instructions:

  • Open the command palette (see next table)

    Operating System Action Keyboard Shortcut
    Linux Open Command Palette Ctrl++P
    OS X Open Command Palette ++P
    Windows Open Command Palette Ctrl++P
  • Type 'install'

  • Select Package Control: Install Package

  • Type 'dart'

  • Select Dart

You may need to restart Sublime Text before you can start using all the features in the Dart plugin.

Manually

Clone the source repository from:

https://github.com/guillermooo/dart-sublime-bundle-releases

Copy its content to a new directory named Dart inside <Data>/Packages/Dart.

You can access the Packages folder from the Sublime Text main menu: Preferences → Browse Packages. Alternatively, you can open the command palette (see table above) and select the Browse Packages item.

Configuring

You will need to tell the plugin where the Dart SDK directory is located.

Open the Dart settings file

In Sublime Text, open your Dart settings file (Packages/User/Dart - Plugin Settings.sublime-settings).

There are two ways to open this file.

We recommend using the main menu. Go to Preferences → Package Settings → Dart → Settings – User.

Alternatively, you can use the command palette.

Operating System Action Keyboard Shortcut
Linux Open Command Palette Ctrl++P
OS X Open Command Palette ++P
Windows Open Command Palette Ctrl++P

Open the command palette, then select Preferences: Dart Settings - User.

Set dart_sdk_path

This plugin works best with Dart SDK 1.9 or greater. It will work with Dart SDK 1.8, but the live analysis features will not work. We recommend Dart SDK 1.9 or greater.

Set dart_sdk_path to the path where the Dart SDK is located on your system

{
  "dart_sdk_path": "/path/to/dart-sdk"
}

Using homebrew? The best directory to use is $HOMEBREW_INSTALL_LOCATION/opt/dart/libexec/

Note: This is not the path to the bin directory within the Dart SDK, but the SDK's top-level directory.

Troubleshooting

To see live errors and warnings, your project must include a pubspec.yaml file (even if you do not require any packages). This plugin uses that file to learn where the project root is.

The most minimal pubspec.yaml file can be:

name: my_project
version: 0.0.1
description: My project.
Clone this wiki locally