flutter_unused_packages 1.0.1
flutter_unused_packages: ^1.0.1 copied to clipboard
“A CLI tool to scan, detect and remove unused dependencies in Flutter projects, improving code organization.”
🛠️ flutter_unused_packages #
⚠️ Important:
This tool is not meant to be used inside Flutter applications.
It is designed exclusively for development environments.
🖥️ Supported Platforms #
✅ This CLI runs on:
- ✅ Windows
- ✅ Linux
- ✅ macOS
🚫 Not compatible with:
- ❌ Android
- ❌ iOS
- ❌ Web
📌 Overview #
flutter_unused_packages is a highly efficient CLI tool designed to analyze, detect, and safely remove unused dependencies in Flutter projects. By helping to keep your pubspec.yaml clean, this tool can improve project maintainability and prevent potential version conflicts.
🚀 Key Features #
- Automated Analysis: Quickly identifies dependencies that are no longer used in your codebase.
- Interactive Removal: Offers a safe removal process, giving you complete control over which dependencies get uninstalled.
- Multi-Platform: Compatible with Linux, macOS, and Windows.
- Configurable: Allows customization via a JSON config, making it flexible for various project structures.
- CI/CD Integration: Easily integrate into your existing pipeline to maintain a clean dependency list.
📦 Installation #
Ensure you have Dart installed:
dart --version
Install the package globally:
dart pub global activate flutter_unused_packages
🚀 Usage #
Use the following commands to manage your dependencies:
flutter_unused_packages --init # Generates a default config file (analize_unused_packages.json)
flutter_unused_packages --analyze # Analyzes your project for unused dependencies
flutter_unused_packages --fix # Automatically removes unused dependencies
flutter_unused_packages --help # Shows help information
🔎 Example #
# Step 1: Generate default config
flutter_unused_packages --init
# Step 2: Analyze for unused dependencies
flutter_unused_packages --analyze
# Step 3: Automatically fix unused dependencies
flutter_unused_packages --fix
🗂️ JSON Configuration #
A sample config file (analize_unused_packages.json
) might include:
{
"directories_to_analyze": ["lib", "bin", "test"],
"directories_to_ignore": [
"build",
".dart_tool",
"android",
"ios",
"linux",
"macos",
"windows"
]
}
You can customize the paths to suit your project layout.
🤖 CI/CD Integration #
Seamlessly integrate flutter_unused_packages with your CI/CD pipeline. Below is an example using GitHub Actions:
name: Dart CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies
run: dart pub get
- name: Generate mocks (Mockito)
run: dart run build_runner build --delete-conflicting-outputs
- name: Analyze code
run: dart analyze
- name: Run tests
run: dart test
- name: Check for unused dependencies
run: flutter_unused_packages --analyze
📖 Documentation #
🤝 Contributing #
We appreciate all contributions! If you want to:
- Report a bug or suggest a feature, create an Issue.
- Make a code contribution, follow these steps:
- Fork the repo
- Create your feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/new-feature
) - Open a Pull Request
- See our Contributing Guide for more details.
🎯 Roadmap #
- ❌ Support for Monorepo Projects: Analyze multiple Flutter modules in a single repository
- ❌ Enhanced Logging: Provide more detailed reports and logs
- ❌ Custom Rules: Allow advanced, user-defined rules for detecting unused dependencies
- ❌ IDE Extensions: Integrate with popular IDEs such as VS Code and IntelliJ
🔥 Show Your Support #
If you find flutter_unused_packages helpful, please leave a ⭐ and share it with others to help grow our community!
📜 License #
flutter_unused_packages is licensed under the MIT License.
© 2025 ERIK MENDES.