A comprehensive Flutter development toolkit for app size optimization, dependency analysis, code cleanup, and developer productivity.
Version 2.0 brings major improvements with beautiful CLI, dependency analysis, and much more!
- Find unused assets in your Flutter project
- Identify large assets that should be optimized
- Scan project files for asset references
- Detailed reports with file sizes
- Detect unused dependencies in
pubspec.yaml - Show latest package versions from pub.dev
- Find orphaned dev dependencies
- Interactive cleanup suggestions
- Safely remove unused assets
- Interactive selection mode
- Dry-run option to preview changes
- Backup support before deletion
- Optimize PNG, JPG, JPEG, GIF, WebP images
- Configurable quality settings
- Batch processing
- Before/after size comparison
- Colored output with progress indicators
- Interactive prompts and confirmations
- JSON output for CI/CD integration
- Command categories and better help
- Comprehensive YAML configuration
- Customizable thresholds and exclusions
- Per-feature settings
- Easy setup with interactive prompts
Option 1: Global Activation (Recommended)
Activate the package globally for easy access from anywhere:
dart pub global activate flutter_app_size_reducerAfter activation, you can use the short command:
fasr --helpOption 2: Add as Dev Dependency
Add to your pubspec.yaml:
dev_dependencies:
flutter_app_size_reducer: ^2.0.0Then run:
flutter pub getWith Global Activation (Short Command)
# Initialize configuration
fasr init
# Analyze your project
fasr analyse
# Analyze only dependencies
fasr analyse --type=dependencies
# Clean unused assets
fasr clean --dry-run
# Optimize images
fasr optimize --quality=85Without Global Activation (Dev Dependency)
dart run flutter_app_size_reducer init
dart run flutter_app_size_reducer analyse
# ... etcπ‘ Pro Tip: Use global activation for the best experience! Just type
fasrinstead of the long command.
fasr init [options]Options:
--path=<path>- Custom configuration file path
fasr analyse [options]Options:
--type=<type>- Analysis type:assets,dependencies,all(default:all)--export=<path>- Export report to file
Examples:
# Analyze everything
fasr analyse
# Only analyze dependencies
fasr analyse --type=dependencies
# Export results
fasr analyse --export=report.jsonfasr clean [options]Options:
--dry-run- Show what would be deleted without deleting--force- Skip confirmation prompt
fasr optimize [options]Options:
--quality=<n>- JPEG quality (1-100, default: 85)--dry-run- Show what would be optimized without optimizing--force- Skip confirmation prompt
All commands support:
--help,-h- Show help--version,-v- Show version--json- Output in JSON format (for CI/CD)--[no-]color- Enable/disable colored output--verbose- Enable verbose logging
The flutter_app_size_reducer.yaml file structure:
assets:
maxAssetSize: 1048576 # 1MB in bytes
excludeExtensions:
- ttf
- otf
- json
excludePaths:
- assets/fonts/
- assets/config/
optimizeImages: true
optimizeQuality: 85
imageFormats:
- png
- jpg
- jpeg
- gif
- webp
dependencies:
checkUnused: true
checkOutdated: true
excludePackages: []
suggestAlternatives: true
code:
detectUnusedCode: true
detectUnusedImports: true
analyzeDirs:
- lib
excludeDirs:
- lib/generated/
minComplexity: 10
build:
buildTypes:
- apk
trackHistory: true
maxHistoryEntries: 10
sizeBudget: 0 # 0 = no budget
reporting:
outputFormat: markdown # markdown, json, html, all
openHtmlReports: false
reportDir: .reports
includeCharts: true
useColors: trueYou can also use the package programmatically in your Dart code:
import 'package:flutter_app_size_reducer/flutter_app_size_reducer.dart';
void main() async {
// Initialize configuration
await FlutterAppSizeReducer.init();
// Analyze project
final results = await FlutterAppSizeReducer.analyze();
print('Analysis complete!');
// Clean unused assets
await FlutterAppSizeReducer.clean(dryRun: true);
// Optimize images
await FlutterAppSizeReducer.optimize(quality: 80);
}- π¨ Beautiful CLI with colors, progress bars, and better UX
- π¦ Dependency Analysis - detect unused packages
- βοΈ Enhanced Configuration - more options and better structure
- π§ Interactive Setup - guided configuration during init
- π Better Reports - more detailed and exportable
- π Improved Performance - faster scanning and analysis
See CHANGELOG.md for detailed changes.
Version 2.0 includes breaking changes. To migrate:
- Backup your old config file
- Run
dart run flutter_app_size_reducer initto create a new config - Review and adjust settings as needed
The new config format provides much more control and new features!
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this package helpful, please:
- β Star the repository
- π Report issues
- π‘ Suggest new features
- π€ Contribute code
Made with β€οΈ for the Flutter community