π DevLens
Flutter Dependency Explorer. A developer tool to analyze any Flutter or Dart project and generate an interactive architecture and dependency visualization map.
β¨ Features
- π Offline HTML Dashboard: Generates a stunning 6-tab Onboarding Dashboard (Learning Path, Risk Report, Folder Map, Dead Code, Graph).
- π§ AST Code Analysis: Uses the official
analyzerpackage to statically parse Dart files, extracting imports and file types. - ποΈ Architecture Health Score: Detects Circular Dependencies, God Classes, and Highly Coupled files to grade your codebase.
- πΊοΈ Learning Path: Automatically calculates the optimal reading order for a new developer to understand the project in 10 minutes.
- π Dead Code Detection: Highlights orphaned files that have zero incoming dependencies.
π Getting Started
Installation
Activate the CLI globally via pub:
dart pub global activate devlens
Usage
Run the scanner in the root of any Flutter or Dart project:
devlens scan
You can also specify a specific path:
devlens scan --path /path/to/your/flutter_project
πΊοΈ How it Works & Where Everything Goes
When you run devlens scan, here is what happens under the hood and where the outputs are generated:
1. Parsing Phase [Click to expand]
The
DartParser scans through your project's lib/ directory, reading every .dart file. It extracts dependencies and identifies the type of each component (e.g., is it a State, Screen, or Repository?).
2. Graph Generation [Click to expand]
The parsed files are converted into a connected
DependencyGraph. This engine models the nodes (files) and edges (imports) of your architecture.
3. Output (.dep_explorer/) [Click to expand]
Once the scan is complete, DevLens creates a new directory in your project root called
.dep_explorer/. Inside this folder, it generates an
index.html file which automatically opens in your browser. This contains the full 6-tab Onboarding Dashboard!
π Source Code Architecture
Curious about how DevLens itself is built? Here's a quick overview of our source code:
- π
bin/: Contains the executable entrypoint (devlens.dart). - π
lib/cli/: The command-line interface logic and command runner. - π
lib/packages/parser/: The Dart analyzer code that reads your files. - π
lib/packages/graph_engine/: Data structures for the dependency graph. - π
lib/packages/reports/: Exporters that write the.dep_explorer/outputs.
π€ Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Libraries
- cli/command_runner
- cli/commands/explain_command
- cli/commands/scan_command
- devlens
- packages/architecture_analyzer/architecture_detector
- packages/architecture_analyzer/learning_path_detector
- packages/architecture_analyzer/project_summary
- packages/architecture_analyzer/tech_stack_detector
- packages/graph_engine/models
- packages/parser/dart_parser
- packages/reports/html_exporter
- packages/reports/json_exporter