pubghost
1.1.0, released 2 months ago by novadev.be
A CLI tool to find unused translations, dependencies, or classes in a Flutter project.
What it does
Pubghost is a fast, lightweight CLI tool that scans your Flutter or Dart project to detect unused dependencies in pubspec.yaml, unused classes or widgets in the lib/ folder, and unused intl translation keys from .arb or .json files. It supports ignoring specific dependencies and classes through configuration.
AI-written summary of version 1.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to clean up dead code and unused classes in your Flutter app.
- You need to detect unused dependencies declared in your pubspec.yaml.
- You want to find missing or unused internationalization (intl) keys.
Skip it when
- Your project relies heavily on dynamic code generation or reflection where static import/usage analysis fails.
- You are looking for a runtime performance profiling tool.
Strengths
- Fast and lightweight CLI that can be run locally or in CI.
- Supports chaining flags for scanning multiple targets at once (-dct).
- Allows pattern-based and exact ignoring of classes and dependencies via pubspec.yaml.
Weaknesses
- Heuristic-based scanning can produce false positives or negatives in advanced scenarios like reflection or dynamic imports.
- Limited to specific pre-defined localization accessor patterns.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add pubghost as a dev_dependency in pubspec.yaml and run dart pub get, or activate it globally using dart pub global activate pubghost.
dart run pubghost -dctWorks with
Packages commonly used together with pubghost: ones it builds on, ones built on it, and its own family.