πŸ“¦ SmartPub - Flutter Dependency Analyzer

The smart way to manage Flutter dependencies.

pub package License: BSD-3-Clause

SmartPub is a CLI tool for Flutter & Dart projects that helps you identify unused dependencies and organize your pubspec.yaml in a clean, predictable way.

Over time, Flutter projects often accumulate unused or poorly organized packages. SmartPub makes it easy to preview, clean, and categorize dependencies without risking accidental changes.


πŸ€” Why SmartPub?

In real Flutter projects:

  • Unused packages increase build time and maintenance cost
  • pubspec.yaml becomes hard to read as dependencies grow
  • Developers hesitate to clean dependencies due to fear of breaking the app

SmartPub solves this by:

  • Detecting unused dependencies safely
  • Providing preview-first workflows
  • Offering interactive modes before making changes
  • Keeping actions explicit and predictable

No magic. No hidden behavior.


✨ What SmartPub Does

SmartPub focuses on two core features only:

1️⃣ Unused Dependency Detection

  • Scans your project source code
  • Detects unused dependencies
  • Allows preview before removal
  • Supports interactive confirmation

2️⃣ Dependency Categorization (beta)

Powered by FlutterGems

  • Groups dependencies into logical categories
  • Uses known ecosystem data
  • Supports preview, auto-apply, and interactive overrides

πŸš€ Installation

dart pub global activate smartpub

Make sure Dart’s global bin is in your PATH.


🧭 Usage Overview

smartpub [command] [options]

If no command is provided, SmartPub runs in preview mode.


πŸ” Commands

check (default)

Preview unused dependencies (read-only).

smartpub
smartpub check

βœ” No files are modified.


clean

Remove unused dependencies.

smartpub clean

Interactive cleanup

Review each removal before applying changes.

smartpub clean --interactive

A backup of pubspec.yaml is created automatically.


group

Preview dependency categorization.

smartpub group

Apply categorization automatically

smartpub group --apply

Interactive categorization

Override suggested categories interactively.

smartpub group --interactive

This is useful when you want full control over how packages are grouped.


restore

Restore pubspec.yaml from the last backup.

smartpub restore

update

Update SmartPub to the latest version.

smartpub update

βš™οΈ Options

--apply          Apply changes automatically
--interactive    Review and confirm changes interactively
--no-color       Disable colored output (CI-friendly)
-h, --help       Show help information
-v, --version    Show version information

πŸ§ͺ Typical Workflow

A safe and recommended workflow:

smartpub            # preview unused dependencies
smartpub clean      # remove unused dependencies
smartpub group      # preview categorization
smartpub group --interactive

This keeps changes intentional and reviewable.


πŸ›‘οΈ Safety Guarantees

  • SmartPub never modifies files without intent
  • Preview is the default behavior
  • Backups are created before changes
  • Interactive mode is available for sensitive operations

πŸ“¦ Project Scope (Important)

SmartPub intentionally does not:

  • Modify versions automatically
  • Upgrade or downgrade dependencies
  • Guess architectural intent

Its goal is clarity and cleanliness, not automation overload.


πŸ“ž Support


Made with ❀️ by Vatsal Jaganwala

Libraries

categorization/categorization
SmartPub Categorization
categorization/gems_integration
Package Categorization Integration
categorization/grouping_service
Package Grouping Service
categorization/models/grouped_dependencies
Grouped dependencies model
categorization/models/package_category
Package category model
categorization/models/package_suggestion
Package suggestion model
categorization/services/api_service
API service for package categories from SmartPub Worker
categorization/services/cache_service
Local cache service for package categories
categorization/services/package_categorizer
Simple package categorization service
categorization/suggestion_service
Package Suggestion Service
core/analyzer
SmartPub Dependency Analyzer
core/config
SmartPub Configuration
core/core
Core SmartPub functionality
core/models/dependency_info
Dependency Information Model
core/strings
String Constants
services/apply_service
Apply Service
services/backup_service
Safety Backup Service
services/pubspec_manager
Pubspec Manager
services/services
SmartPub Services
services/update_checker
Update Checker Service
smartpub
SmartPub - Flutter Dependency Analyzer
telemetry/telemetry
SmartPub Telemetry
telemetry/telemetry_service
Telemetry Service
ui/cli_output
CLI Output Formatter
ui/interactive_grouping_service
Interactive Grouping Service
ui/interactive_service
Interactive Service
ui/ui
SmartPub User Interface