flutter_arch_lens 1.0.2
flutter_arch_lens: ^1.0.2 copied to clipboard
Architecture analyzer for Flutter/Dart projects (CLI). Generates dependency graphs, detects cycles, and enforces layering rules.
flutter_arch_lens Example #
This example demonstrates how to use flutter_arch_lens to analyze a Flutter project's architecture.
Project Structure #
example/
├── lib/
│ ├── core/
│ │ └── utils.dart
│ ├── features/
│ │ ├── auth/
│ │ │ ├── presentation/
│ │ │ ├── domain/
│ │ │ └── data/
│ │ └── home/
│ │ ├── presentation/
│ │ ├── domain/
│ │ └── data/
│ └── main.dart
├── .arch_lens.yaml
└── pubspec.yaml
Usage #
1. Basic Analysis #
Run the default architecture analysis:
dart run flutter_arch_lens
This will scan your project and generate a report showing:
- Number of files scanned
- Architecture health score
- Detected circular dependencies
- Layer rule violations
2. Explain Mode #
Understand your current project structure:
dart run flutter_arch_lens --explain
This shows:
- Layer distribution
- File-to-layer mapping
- Architecture patterns detected
3. Recommend Mode #
Get architecture improvement suggestions:
dart run flutter_arch_lens --recommend
4. JSON Output #
Generate a JSON report:
dart run flutter_arch_lens --format json
5. Save Report to File #
dart run flutter_arch_lens --format json --out report.json
Configuration #
This example includes a .arch_lens.yaml configuration file that enforces Clean Architecture principles:
- Presentation layer can depend on: domain, data, core
- Domain layer can depend on: core only
- Data layer can depend on: domain, core
- Core layer has no dependencies
Running the Example #
-
Navigate to the example directory:
cd example -
Get dependencies:
flutter pub get -
Run the architecture analysis:
dart run flutter_arch_lens
Expected Output #
flutter_arch_lens report
Root: /path/to/example
Files scanned: 15
Score: 100/100
Cycles: 0
Violations: 0
Detected structure: Feature-first (lib/features/**)
✓ No circular dependencies detected.
✓ No layer rule violations detected.
Learn More #
For complete documentation, visit the main README.