ka
Khairul Azharsenior software engineer
All writing
TutorialAug 16, 2026 · 4 min

Enable Dart/Flutter LSP in Claude Code for Lightning-Fast Code Navigation

Claude Code uses grep by default, slow and imprecise for large Flutter codebases. Enable LSP to connect it to Dart's built-in analysis server and get go-to-definition, find-references, and real-time diagnostics in milliseconds. No extra install needed, the analysis server ships with Flutter SDK.

KA
Khai
Senior Software Engineer
cover image

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 defined

  • findReferences — finds every usage across your entire codebase

  • workspaceSymbol — searches all symbols without reading a single file

  • hover — gets type info without opening the file

  • Automatic 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.x

If 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 dart

Step 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 --version

Only 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-lsps

Older 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-lsps

Dart 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
claude

Testing 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:1

You’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 proceeding

How 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 enabledPlugins

The 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

Next essay

Deploying a Flutter App to Google Play in 2025: A Fast, Safe, End-to-End Guide

A concise, up-to-date deployment guide for Flutter apps: signing, building AAB, testing on Play tracks, policy checks, and publishing to Production.

ka

I design and ship resilient mobile platforms and the backends that keep them honest.

© 2026 · Privacy · v4.2.0 · commit 8a3f12c