flutter_prunekit 1.1.1
flutter_prunekit: ^1.1.1 copied to clipboard
Blazing-fast static analyzer for detecting unused classes, enums, mixins & extensions in Dart/Flutter. 100% precision, zero false positives.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.1 #
Added #
- Part file analysis - Full support for
partandpart ofdirectives with zero false positives - Cross-part references - Correctly tracks class usage across part boundaries
- Code generation support - Works with Realm, Freezed, and other generators
- Warning system - Non-fatal warnings for part file issues with actionable suggestions
- 122 new tests - Comprehensive part file test coverage (208 total tests)
Fixed #
- Realm
$ClassNamemodels no longer falsely reported when using--include-generated - Freezed generated classes correctly detected across part boundaries
- Generated code in part files properly analyzed
Performance #
- <0.5% regression on part-heavy projects (actually -0.1% improvement with caching)
- 100% precision and recall maintained
1.0.0 #
Initial Release #
Production-ready dead code analyzer for Dart & Flutter with 100% precision and 100% recall.
Core Features #
- Detects unused: Classes, abstract classes, mixins, enums, extensions
- Smart analysis: Tracks instantiation, type annotations, inheritance, generics, static methods
- Flexible ignoring:
@keepUnusedannotation, config file patterns, CLI exclusions - Generated code aware: Auto-excludes
*.g.dart,*.freezed.dart,*.realm.dart - Fast: <5s for 10k LOC, <30s for 50k LOC
- Cross-platform: macOS, Linux, Windows
CLI Options #
--path <path> # Paths to analyze (default: lib/)
--exclude <pattern> # Glob patterns to exclude
--include-tests # Analyze test files
--include-generated # Analyze generated code
--ignore-analysis-options # Skip analysis_options.yaml
--verbose # Show detailed progress
--quiet # Show results only
Configuration #
Create flutter_prunekit.yaml:
exclude:
- 'lib/legacy/**'
- '**/old_*.dart'
ignore_annotations:
- 'deprecated'
- 'experimental'
Quality Metrics #
| Metric | Result |
|---|---|
| Precision | 100% (0 false positives) |
| Recall | 100% (catches all unused code) |
| Test Coverage | 86 tests |
| Memory Usage | <500MB for 100k LOC |
Known Limitations #
- Classes used via
dynamicmay not be tracked (warning issued) - Reflection/mirrors not detected
- Platform-specific imports may need
@keepUnused
Installation #
# Add to project
dart pub add --dev flutter_prunekit
# Or install globally
dart pub global activate flutter_prunekit
Usage #
# Basic analysis
dart run flutter_prunekit
# With options
dart run flutter_prunekit --path lib --exclude 'lib/legacy/**' --verbose