PhpStorm supports developing, running, and debugging Dart web and command-line applications. PhpStorm recognizes
*.dart files and marks them with the icon.
When the Dart support is enabled, PhpStorm provides full coding assistance, which involves code completion, error and syntax highlighting, code inspections and quick-fixes, search and navigation, refactoring, and much more. PhpStorm also integrates with the pub tool and the Dart Analysis Server.
Before you start, install and enable the Dart repository plugin on the Plugins page as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Downloading the Dart tools
To have all the tools for developing both command-line and web Dart applications:
- Download and install the Dart SDK.
The Dart SDK incorporates the Dart Virtual Machine, the Dart Libraries, as well as all the command line tools, including compilers (dart2js and dartdevc) and the pub tool.
- For web development, optionally download the Dartium browser.
Learn more about the Dart development tools from the Dart Official website.
Configuring Dart support in a PhpStorm project
You can create a PhpStorm project with Dart-specific structure from a Stagehand template or add Dart support in an existing PhpStorm project.
- Choose File | New Project on the main menu or click Create New Project on the Welcome screen. The New Project Dialog opens.
- In the left-hand pane, choose Dart.
- In the right-hand pane, specify the project name and the path to the folder where the project-related files will be stored.
- Specify the paths to the Dart SDK and optionally to the Dartium executable file (Windows and Linux)/Dartium application (macOS). PhpStorm detects and displays the Dart version.
- To have a sample application created in the project, select the Generate sample content check box and choose the relevantStagehand template from the list below. If you clear the check box, PhpStorm creates and empty project.
- Click Create. PhpStorm sets up the project structure and generates some sources based on the selected Stagehand template.
- Open the Dart page ( for Windows and Linux or for macOS).
- Select the Enable Dart support for the project <project name> check box.
- In the Dart SDK Path text box, specify the location of the downloaded Dart SDK. Type the path manually or click and choose the path in the dialog box that opens. If PhpStorm recognizes the Dart SDK correctly, its revision number is displayed in the Version read-only field.
- For Dart web development: optionally specify the location of the Dartium executable (Windows and Linux)/Dart application (macOS). Type the path manually or click and choose the path in the dialog box that opens. Learn more about Dart web tools from the the Dart Official website,
Adding a Dart project (package) to a PhpStorm project
If your application consists of several Dart projects (packages), you can develop all of them within one PhpStorm project. To attach a Dart project (package) to an existing PhpStorm project you need to add its root folder as a content root.
- Open the Directories page ( for Windows and Linux or for macOS).
- In the right-hand pane with a list of existing content roots, click Add Content Root. Then in the dialog box that opens, choose the root folder of the Dart project (package) to be attached.