Languages / Dart and Flutter
Dart and Flutter code analysis: unused code, widget trees and complexity
dart analyze reports unused imports and private elements in a Flutter app. repowise adds the repository view: package: imports resolve across every pubspec.yaml in a monorepo, Flutter route tables, GoRoute and MaterialPageRoute builders and runApp link the screens, and unused files are ranked by git history, with health and performance markers on the same graph.
Last reviewed: November 2026
Good tier
What repowise detects in Dart and Flutter
Checked against the engine source. Every row runs locally with zero LLM calls.
| Files parsed | .dart |
|---|---|
| Import resolution | Full. package: URIs through a pubspec name-to-directory index (several pubspecs per repository), relative imports, export, part and part of |
| Call graph | Resolved calls and inheritance |
| Dead code | Unreachable files and unused exports |
| Health markers | Complexity and class metrics |
| Performance markers | http and dio calls, File reads and writes, sqflite raw queries and Process.run in loops, serial await, string concatenation and HttpClient construction in loops |
| Coverage reports | lcov from flutter test --coverage |
| Frameworks recognised | Flutter route tables, GoRoute and MaterialPageRoute builders, runApp root, widget trees |
Specific to this language
How Dart and Flutter code is read
Screens are reached through routes
A screen nobody imports is often reached through a route table ('/cart': (ctx) => CartPage()), a GoRoute builder or a MaterialPageRoute. Those become edges, and runApp(Root()) marks the app's entry point.
Monorepos with many packages
package:<name>/ imports map through every pubspec.yaml in the repository, so a Melos-style workspace with shared packages resolves as one graph. Other package URIs become external pub nodes; dart: imports are dropped.
Stated scope
Dependency injection and code generation (riverpod, get_it, build_runner output) are out of scope for edges. Generated files are classified as generated code and not judged as dead.
Honest comparison
Native Dart and Flutter tools, and when they are enough
| Tool | What it covers |
|---|---|
| dart analyze | Analyzer lints: unused_import, unused_element, unused_local_variable and many more. |
| DCM (Dart Code Metrics) | Commercial tool with check-unused-code, check-unused-files and metrics. |
| flutter test --coverage | Writes coverage/lcov.info, which repowise reads. |
Where repowise adds value
- Unused public files and screens across packages, with route and widget-tree edges.
- Hotspots, ownership and co-change from git history.
- The Flutter app, its Dart packages and a backend in another language in one graph.
How to run it
Analyse a Dart and Flutter repository
From the repository root. Agents get the same results through the get_dead_code, get_health and get_context MCP tools.
uv tool install repowise # or: pipx install repowise
repowise init --yes --no-prose # index the repo, no API key
repowise dead-code --min-confidence 0.7 --safe-only
repowise health --refactoring-targets
flutter test --coverage
repowise coverage add coverage/lcov.info
repowise serve # graph, health and dead code in a local dashboardQuestions
What people ask before they try it.
How do I find unused Dart files in a Flutter project?
Run repowise dead-code --kind unreachable_file. Files reached from runApp, route tables, GoRoute builders and imports are live; the rest are reported with a confidence and an owner.
Does it support Melos or multi-package repositories?
Yes. Every pubspec.yaml in the repository is indexed, so package: imports between local packages resolve.
Can it read Flutter test coverage?
Yes. flutter test --coverage writes lcov, and repowise coverage add coverage/lcov.info reads it.
Does repowise send my Dart code to an LLM?
No. Parsing, the call graph, dead code, health scores, performance markers and git history all run locally with zero LLM calls. repowise init --yes --no-prose needs no API key, and the analysis itself makes no network calls. Written documentation prose is the one opt-in step that uses a model, and it can run on a local Ollama model.
Related reading
Index a Dart and Flutter repository.
Public repositories are free on repowise.dev. The CLI is open source and runs on your machine with no API key.