Provides Flutter and Dart development workflows using dart-mcp tools...
Run tests:
dart_analyzer ā Catch compile errors first
dart_run_tests ā Execute tests
Debug running app:
get_runtime_errors ā Capture current errors
get_widget_tree ā Inspect UI hierarchy
[make fix]
hot_reload ā Apply changes
get_runtime_errors ā Verify fix
Understand an API:
dart_resolve_symbol ā Get signature and documentation
| Tool | Purpose | When to Use |
|---|---|---|
dart_analyzer |
Static analysis for errors, warnings, hints | After writing code, before running tests |
dart_format |
Apply consistent code formatting | After all code changes |
dart_fix |
Apply automated fixes for analyzer issues | When analyzer reports fixable issues |
Testing:
| Tool | Purpose | When to Use |
|---|---|---|
dart_run_tests |
Execute Dart/Flutter tests | After writing tests, in TDD cycles |
Symbol Resolution:
| Tool | Purpose | When to Use |
|---|---|---|
dart_resolve_symbol |
Get symbol documentation and signatures | Understanding APIs, checking method signatures |
Package Discovery:
| Tool | Purpose | When to Use |
|---|---|---|
pub_dev_search |
Search pub.dev for packages | Finding packages for specific functionality |
| Tool | Purpose | When to Use |
|---|---|---|
get_runtime_errors |
Fetch current runtime errors and stack traces | First step in debugging, verify fixes |
get_widget_tree |
Inspect widget hierarchy at runtime | Layout debugging, finding widget issues |
hot_reload |
Apply code changes without losing state | After making fixes, during development |
hot_restart |
Full restart preserving debug session | When hot reload fails or state is corrupted |
Prerequisites: App must be running in debug mode with Dart tooling daemon connected.
| Tool | Purpose | When to Use |
|---|---|---|
mcp__ide__getDiagnostics |
Get IDE diagnostics for a file | Check for issues in specific file |
mcp__ide__readFile |
Read file contents | Understanding existing code |
mcp__ide__writeFile |
Write/create files | Creating new files |
mcp__ide__getCurrentEditor |
Get active editor content | Context-aware operations |
mcp__ide__getOpenEditors |
Get currently open files | Understanding user context |
mcp__ide__searchInProject |
Search across project files | Finding patterns, usages |
mcp__ide__getProjectStructure |
Get project file tree | Understanding project layout |
1. Write failing test
2. dart_run_tests ā Verify RED (test fails)
3. Write minimal implementation
4. dart_run_tests ā Verify GREEN (test passes)
5. Refactor code
6. dart_run_tests ā Verify still GREEN
7. dart_analyzer ā Check for issues
8. dart_format ā Apply consistent style
This cycle ensures tests drive implementation and code quality stays high.
1. Verify app is connected:
get_runtime_errors ā If fails, app not connected
2. Gather evidence:
get_runtime_errors ā Capture current errors
get_widget_tree ā Inspect UI structure
3. Analyze error patterns:
- RenderFlex overflow ā Layout constraints issue
- Null check operator ā Null safety issue
- setState after dispose ā Lifecycle issue
4. Make targeted fix (use mcp__ide__readFile/writeFile)
5. Apply and verify:
hot_reload ā Apply changes
get_runtime_errors ā Should be empty or reduced
6. If hot_reload fails:
dart_analyzer ā Check for syntax errors
hot_restart ā Try full restart
1. dart_analyzer ā Must show 0 errors, 0 warnings
2. dart_run_tests ā All tests must pass
3. dart_format ā Apply consistent formatting
4. dart_fix ā Apply any remaining automated fixes
Performs static analysis on Dart/Flutter code.
Returns:
Best Practices:
Example Output:
lib/src/auth/repository.dart:45:12
ERROR: The argument type 'String' can't be assigned to parameter type 'int'
lib/src/widgets/profile.dart:23:5
WARNING: Unused import 'package:flutter/foundation.dart'
Analysis complete. 1 error, 1 warning.
Executes Dart/Flutter tests with filtering and coverage.
Options:
path/to/test_file.dart--name "test description"--coverage--reporter expandedBest Practices:
dart_analyzer first to catch compile errorsInterpreting Results:
ā should return user when authenticated
ā should throw when token expired
ā should handle network timeout
Expected: Left<NetworkFailure>
Actual: Right<User>
2 passed, 1 failed
Resolves symbols to their documentation and type signatures.
Use Cases:
Example:
Query: "TaskEither.tryCatch"
Result:
TaskEither<L, R>.tryCatch(
Future<R> Function() run,
L Function(Object error, StackTrace stackTrace) onError,
)
Creates a TaskEither that runs the given function and catches any errors.
Best Practices:
Fetches current runtime errors from a running Flutter app.
Requires: App running in debug mode with daemon connected.
Returns:
Best Practices:
Common Error Patterns:
RenderFlex overflowed ā Layout constraintsNull check operator used on null value ā Null safetysetState() called after dispose() ā Lifecycle bugtype 'Null' is not a subtype ā Type mismatchget_widget_tree
Inspects the widget hierarchy of a running Flutter app.
Returns:
Use For:
Look For:
hot_reload
Applies code changes to a running app without losing state.
When It Works:
When It Fails:
If Hot Reload Fails:
dart_analyzer to check for errorshot_restart for full restartCorrect Order:
dart_analyzer ā dart_run_tests ā dart_format
get_runtime_errors ā [fix] ā hot_reload ā get_runtime_errors
dart_analyzer shows 0 errors before running testsdart_run_tests executes without compile failuresget_runtime_errors returns empty after fix verificationhot_reload succeeds (no syntax errors in code)Uncertainty Handling: