π¦ SmartPub - Flutter Dependency Analyzer
The smart way to manage Flutter dependencies.
A cross-platform Dart/Flutter developer tool that analyzes and cleans dependencies in your pubspec.yaml file. SmartPub runs on Windows, macOS, and Linux, identifying unused, misplaced, and duplicate dependencies to keep your Flutter projects clean and efficient.
β¨ Features
- π Smart Analysis - Scans your entire project to detect dependency usage patterns
- π§Ή Auto-Fix - Automatically removes unused dependencies and fixes misplaced ones
- π€ Interactive Mode - Prompts for confirmation before making changes
- π‘οΈ Safety First - Creates backups before modifications with easy restore
- π Duplicate Detection - Finds and resolves duplicate dependencies with version conflicts
π Platform Support
SmartPub works with Flutter projects targeting any platform:
- β Android
- β iOS
- β Web
- β macOS
- β Windows
- β Linux
π Installation
Global Installation (Recommended)
dart pub global activate smartpub
Local Installation
Add to your pubspec.yaml:
dev_dependencies:
smartpub: ^1.0.0
Then run:
dart pub get
π Usage
Basic Analysis
# Analyze dependencies without making changes
smartpub --analyse
# Or simply
smartpub
Auto-Fix Mode
# Automatically fix all issues
smartpub --apply
Interactive Mode
# Review and apply changes interactively
smartpub --interactive
Restore from Backup
# Restore previous version
smartpub --restore
Update SmartPub
# Update to the latest version
smartpub --update
CI-Friendly Mode
# Disable colors for CI pipelines
smartpub --analyse --no-color
π Command Reference
| Command | Description |
|---|---|
smartpub or --analyse |
Analyze dependencies without making changes |
--interactive |
Review and apply changes interactively |
--apply |
Automatically apply fixes |
--restore |
Restore pubspec.yaml from backup |
--update |
Update SmartPub to the latest version |
--no-color |
Disable colored output |
--help |
Show help information |
--version |
Show version information |
π― What SmartPub Detects
β Used Dependencies
Dependencies that are properly used in your lib/ directory.
π§© Misplaced Dependencies
Dependencies used only in test/, bin/, or tool/ that should be in dev_dependencies.
β οΈ Unused Dependencies
Dependencies declared but never imported in your code.
π Duplicate Dependencies
Packages declared in both dependencies and dev_dependencies with intelligent recommendations.
π Example Output
π¦ SmartPub - Flutter Dependency Analyzer
β
Used Dependencies
β
http - used in lib
β
flutter_bloc - used in lib
π§© Move to dev_dependencies
π§© mockito - used in test
β οΈ Unused Dependencies
β οΈ lottie - unused
Summary
Total dependencies scanned: 12
β οΈ 2 issue(s) found that can be fixed
π‘οΈ Safety Features
- Automatic Backups - Creates
pubspec.yaml.bakbefore any modifications - Easy Restore - Restore previous version with
--restorecommand - Error Recovery - Automatically restores backup if operations fail
π§ CI/CD Integration
Use SmartPub in your CI pipeline across different platforms:
# GitHub Actions example (works on ubuntu, windows, macos)
- name: Check dependencies
run: |
dart pub global activate smartpub
smartpub --analyse --no-color
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
π License
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.
π Support
- π Report Issues
- π‘ Feature Requests
Made with β€οΈ by Vatsal Jaganwala
Libraries
- analyzer
- SmartPub Dependency Analyzer
- apply_service
- Apply Service
- backup_service
- Safety Backup Service
- cli_output
- CLI Output Formatter
- config
- SmartPub Configuration
- interactive_service
- Interactive Service
- models/dependency_info
- Dependency Information Model
- pubspec_manager
- Pubspec Manager
- update_checker
- Update Checker Service