flutter_unused_packages 1.0.1 copy "flutter_unused_packages: ^1.0.1" to clipboard
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 #

GitHub stars GitHub license GitHub issues GitHub forks GitHub last commit

flutter_unused_packages logo

⚠️ 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 #

  • Detailed documentation and FAQs are available in the Wiki.
  • Check the CHANGELOG for release notes.

🤝 Contributing #

We appreciate all contributions! If you want to:

  1. Report a bug or suggest a feature, create an Issue.
  2. 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
  3. 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.

4
likes
160
points
39
downloads
screenshot

Publisher

verified publishereebtecnologia.com.br

Weekly Downloads

“A CLI tool to scan, detect and remove unused dependencies in Flutter projects, improving code organization.”

Repository (GitHub)
View/report issues
Contributing

Topics

#flutter #cli #analysis #dependencies #cleanup

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

analyzer, args, glob, yaml

More

Packages that depend on flutter_unused_packages