flutter_prunekit 2.1.0 copy "flutter_prunekit: ^2.1.0" to clipboard
flutter_prunekit: ^2.1.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.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 late and const).
  • 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.field initialisers, 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 @override and 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 this properly detected
  • Abstract methods with @override implementations not flagged
  • Property chains across inheritance hierarchies resolved correctly

1.1.1 #

Added #

  • Part file analysis - Full support for part and part of directives 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 $ClassName models 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: @keepUnused annotation, 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

17
likes
0
points
133
downloads

Publisher

unverified uploader

Weekly Downloads

Ship leaner Dart & Flutter apps by removing unused classes, methods, and variables.

Repository (GitHub)
View/report issues

Topics

#dart #flutter #static-analysis #dead-code #code-quality

Documentation

Documentation

License

unknown (license)

Dependencies

analyzer, ansi_styles, args, glob, path, yaml

More

Packages that depend on flutter_prunekit