flutter_prunekit 2.4.0
flutter_prunekit: ^2.4.0 copied to clipboard
Ship leaner Dart & Flutter apps by removing unused classes, methods, and variables.
Changelog #
All notable changes to this project will be documented in this file.
2.4.0 #
Fixed #
- Record literal getters -
({name: name, value: value})pattern now correctly detected - Enum instance methods - Private helper methods in enums (e.g.,
_buildIcon()) - Standalone getters -
if (isEmpty),return !isValid,while (hasData)patterns - Enum static getters -
MyEnum.staticGetteraccess pattern
Added #
- Field Detection - Detects unused and write-only fields in classes, mixins, enums, and extension types
- Instance and static fields (public/private)
- Write-only detection (fields assigned but never read)
- Field-backed properties (field + getter/setter pairs)
- Constructor tracking (
this.fieldparameters, initializer lists) - Edge cases: string interpolation, cascades, equality operators, compound assignments
- Pattern matching support (Dart 3.0+ with type promotion)
2.3.0 #
Fixed #
- Fixed Windows path normalization issue causing "Failed to parse file (syntax errors or invalid Dart code)" errors on Windows systems
2.2.1 #
Fixed #
- Corrected command name references in documentation from
flutter_dead_codetoflutter_prunekitin README.md, example configuration, and CLI help text - Updated version string in CLI arguments to 2.2.1
2.2.0 #
Added #
- Category-scoped analysis switches:
--only-types,--only-methods, and--only-variableslet you focus reports on a single surface or mix-and-match combinations for custom scans.
Changed #
- CLI workflow now runs through an explicit subcommand: use
flutter_prunekit unused_code [...]for all analyses, with updated help/usage messaging and README guidance. - Default configuration filename renamed to
flutter_prunekit.yaml; all loaders, fixtures, and documentation now look for the new name. - Quick Start documentation now integrates the configuration walkthrough and highlights exclusion patterns in a single, action-oriented section.
2.1.0 #
What's New
- Local variables – detects unused variables inside functions, methods, getters, and blocks.
- Parameters – tracks unused function, method, constructor, and closure parameters.
- Top-level variables – flags unused globals and constants (including
lateandconst). - For-loop variables – monitors loop counters and iterator variables.
- Catch variables – reports unused exception and stack trace bindings.
- Pattern bindings – supports switch/if-case/destructuring patterns from Dart 3.
- Write-only detection – highlights variables that are assigned but never read.
- Smart conventions – honours
_placeholders,this.fieldinitialisers, and other intentional ignores.
Variable-Level Features
-
@keepUnused Annotation - Variable-level ignore support:
@keepUnused final config = loadFromReflection(); void process() { @keepUnused final secretKey = Platform.environment['SECRET']; } -
Config-based Patterns - Flexible variable exclusion:
ignore_variables: - 'temp*' # Ignore temporary variables - 'debug*' # Ignore debug variables ignore_parameters: - 'context' # Often required but unused - '_*' # Intentionally unused
2.0.0 #
Added - Method Detection #
Complete method and function analysis - The biggest feature since v1.0!
What's New
- Top-level Functions - Detects unused global functions
- Instance Methods - Tracks method usage including inherited calls (classes and enums)
- Static Methods - Factory constructors and static method detection (classes and enums)
- Extension Methods - Full extension method tracking with semantic resolution
- Getters & Setters - Property accessor detection (top-level, class-level, and enum-level)
- Operators - Overloaded operator tracking (
+,==,[], etc.) - Private Methods - Unused private method detection
- Override Detection - Correctly handles
@overrideand inheritance chains - Abstract Methods - Smart handling of abstract methods with implementations
- Lifecycle Methods - Auto-excludes Flutter lifecycle methods (
initState,dispose,build, etc.) - Enum Methods - Full support for enum instance methods, static methods, getters, and setters
Fixed #
- Singleton property access (e.g.,
Logger.instance.log()) now correctly tracked - Inherited method calls via implicit
thisproperly detected - Abstract methods with
@overrideimplementations not flagged - Property chains across inheritance hierarchies resolved correctly
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
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