If you’ve been using Claude Code for Flutter development, you’ve probably noticed it relies on text-based grep to find things. Ask “where is this class defined?” and it’ll scan through hundreds of files — slow, and sometimes wrong.
There’s a better way: LSP (Language Server Protocol). The same technology that makes VS Code smart when you Ctrl+Click a symbol. Claude Code supports it natively, and the Dart analysis server ships with the Flutter SDK — no extra install needed.
After enabling it, code navigation goes from 30–60 seconds of grep scanning to sub-100ms with exact, semantically-correct results.
What You Get
goToDefinition— jumps to the exact file and line where a class or function is definedfindReferences— finds every usage across your entire codebaseworkspaceSymbol— searches all symbols without reading a single filehover— gets type info without opening the fileAutomatic diagnostics — after every edit, the analysis server checks for type errors and unused variables in real time
Prerequisites
You need the Dart SDK or Flutter SDK installed. The analysis server ships with both.
# Check if dart is available
dart --version
# Dart SDK version: 3.x.xIf not installed:
# Via Flutter (recommended for Flutter projects)
brew install --cask flutter
# Or standalone Dart SDK (needs the official tap first)
brew tap dart-lang/dart
brew install dartStep 1: Check Your Claude Code Version
Claude Code has had the LSP tool built in — and enabled by default — since 2.0.74 (it’s in the official changelog). Check yours:
claude --versionOnly if you’re on an older version do you need the explicit flag in ~/.claude/settings.json:
{
"env": {
"ENABLE_LSP_TOOL": "1"
}
}Step 2: Add the Piebald Marketplace
The Dart LSP plugin lives in the community marketplace by Piebald-AI. One command registers it — run this inside Claude Code:
/plugin marketplace add Piebald-AI/claude-code-lspsOlder guides (including an earlier draft of this one) tell you to git-clone the repo and hand-edit known_marketplaces.json — that’s no longer needed. The command handles the clone, registration, and auto-update tracking for you.
Step 3: Install the Dart Plugin
claude plugin install dart@claude-code-lspsDart support landed via PR #52, merged March 1, 2026 — it installs straight from the upstream marketplace.
Step 4: Verify It’s Enabled
Check ~/.claude/settings.json — the plugin should appear in enabledPlugins:
{
"enabledPlugins": {
"dart@claude-code-lsps": true
}
}If it’s missing, add it manually.
Step 5: Restart Claude Code
The LSP server needs a fresh session to initialise. Close and reopen Claude Code from your Flutter project directory.
cd /path/to/your/flutter/project
claudeTesting It
Ask Claude to test it:
Test if Dart LSP is working:
1. Run LSP workspaceSymbol on any .dart file
2. Run LSP goToDefinition on a class or import
3. Report whether it responded or fell back to "No LSP server available"A working response looks like:
LSP goToDefinition on import 'package:freezed_annotation/...'
→ Resolved to /Users/khairul/.pub-cache/.../freezed_annotation.dart:1:1You’ll also see automatic diagnostics fire after edits — unused variables, type mismatches, unreferenced declarations — without asking.
Tell Claude to Prefer LSP
Even with LSP enabled, Claude sometimes defaults to grep. Add this to your ~/.claude/CLAUDE.md to enforce it:
## LSP
- Prefer LSP over Grep/Read for code navigation
- workspaceSymbol to find where something is defined
- findReferences to see all usages across the codebase
- goToDefinition / goToImplementation to jump to source
- hover for type info without reading the file
- Use Grep only when LSP isn't available or for text/pattern searches (comments, strings, config)
- After writing or editing code, check LSP diagnostics and fix errors before proceedingHow It Works Under the Hood
Claude Code’s plugin system loads lspServers configuration through a marketplace chain:
known_marketplaces.json
→ marketplaces/<name>/.claude-plugin/marketplace.json (lspServers block)
→ cache/<marketplace>/<plugin>/<version>/.lsp.json (canonical config)
→ installed_plugins.json
→ settings.json enabledPluginsThe Dart plugin’s .lsp.json is minimal — just 12 lines:
{
"dart": {
"command": "dart",
"args": ["language-server", "--protocol=lsp"],
"extensionToLanguage": { ".dart": "dart" },
"transport": "stdio",
"initializationOptions": {},
"settings": {},
"startupTimeout": 60000,
"maxRestarts": 3
}
}startupTimeout: 60000 is important — the Dart analysis server takes a few seconds to index on cold start.
Other Languages
The same Piebald marketplace supports 40+ languages. Once you’ve registered it:
LanguageInstall commandTypeScript/JSclaude plugin install vtsls@claude-code-lspsPythonclaude plugin install pyright@claude-code-lspsGoclaude plugin install gopls@claude-code-lspsRustclaude plugin install rust-analyzer@claude-code-lspsKotlinclaude plugin install kotlin-lsp@claude-code-lsps
The official Anthropic marketplace also has TypeScript, Swift, Python, Go, Rust, C/C++, PHP, and more via claude plugin install <name> — though Dart isn’t in the official set yet (#16849), which is exactly why the community marketplace matters.
Links
Piebald-AI/claude-code-lsps — community LSP marketplace
Dart LSP PR #52 — the PR that added Dart support (merged March 1, 2026)
Original LSP guide for Claude Code by karanb192 — the article that started this