dart.md

 1---
 2title: Dart
 3description: "Configure Dart language support in Zed, including language servers, formatting, and debugging."
 4---
 5
 6# Dart
 7
 8Dart support is available through the [Dart extension](https://github.com/zed-extensions/dart).
 9
10- Tree-sitter: [UserNobody14/tree-sitter-dart](https://github.com/UserNobody14/tree-sitter-dart)
11- Language Server: [dart language-server](https://github.com/dart-lang/sdk)
12
13## Pre-requisites
14
15You will need to install the Dart SDK.
16
17You can install dart from [dart.dev/get-dart](https://dart.dev/get-dart) or via the [Flutter Version Management CLI (fvm)](https://fvm.app/documentation/getting-started/installation)
18
19## Configuration
20
21The dart extension requires no configuration if you have `dart` in your path:
22
23```sh
24which dart
25dart --version
26```
27
28If you would like to use a specific dart binary or use dart via FVM you can specify the `dart` binary in your Zed settings.jsons file:
29
30```json [settings]
31{
32  "lsp": {
33    "dart": {
34      "binary": {
35        "path": "/opt/homebrew/bin/fvm",
36        "arguments": ["dart", "language-server", "--protocol=lsp"]
37      }
38    }
39  }
40}
41```
42
43### Formatting
44
45Dart by-default uses a very conservative maximum line length (80). If you would like the dart LSP to permit a longer line length when auto-formatting, add the following to your Zed settings.json:
46
47```json [settings]
48{
49  "lsp": {
50    "dart": {
51      "settings": {
52        "lineLength": 140
53      }
54    }
55  }
56}
57```
58
59Please see the Dart documentation for more information on [dart language-server capabilities](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/tool/lsp_spec/README.md).