flutter_app_size_reducer 1.0.3
flutter_app_size_reducer: ^1.0.3 copied to clipboard
A Flutter plugin for analyzing and reducing app size through CLI commands.
Flutter App Size Reducer #
A Flutter package that helps reduce your app size by analyzing, cleaning, and optimizing assets.
Features #
- ๐ Asset Analysis: Find unused and large assets in your Flutter project
- ๐งน Asset Cleaning: Remove unused assets to reduce app size
- ๐ Asset Optimization: Optimize large assets to improve performance
- ๐ Detailed Reports: Get comprehensive reports about your assets
- ๐ง Configurable: Customize the behavior through a configuration file
- ๐ ๏ธ CLI Support: Use through command-line interface or programmatically
Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_app_size_reducer: ^<latest_version>
Then run: flutter pub get
Usage #
Command Line Interface #
Initialize the configuration:
dart run flutter_app_size_reducer init
Analyze your assets:
dart run flutter_app_size_reducer analyse
Programmatic Usage #
import 'package:flutter_app_size_reducer/flutter_app_size_reducer.dart';
void main() async {
// Initialize configuration
await FlutterAppSizeReducer.init();
// Analyze assets
final results = await FlutterAppSizeReducer.analyze();
print('Unused assets: ${results['unusedAssets']}');
print('Large assets: ${results['largeAssets']}');
// Clean unused assets
await FlutterAppSizeReducer.clean(dryRun: true);
// Optimize assets
await FlutterAppSizeReducer.optimize(quality: 80);
}
Configuration #
Create a flutter_app_size_reducer.yaml
file in your project root:
# Asset directories to analyze
asset_directories:
- assets/
- images/
# File extensions to consider as assets
asset_extensions:
- .png
- .jpg
- .jpeg
- .gif
- .webp
# Maximum size for assets (in bytes)
max_asset_size: 100000
# Quality for optimized images (0-100)
optimization_quality: 80
# Exclude patterns
exclude_patterns:
- "**/*.min.*"
- "**/generated/*"
Example #
Check out the example directory for a complete usage example.
Contributing #
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Support #
If you encounter any issues or have questions, please open an issue.
Changelog #
1.0.2 #
- Initial release
- Added asset analysis functionality
- Added asset cleaning functionality
- Added asset optimization functionality
- Added configuration system
- Added CLI interface
- Added programmatic API
- Added example app
- Added comprehensive documentation
- Added test coverage
funding:
- type: github url: https://github.com/sponsors/saty-a
Enforcement #
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at https://github.com/saty-a/flutter_app_size_reducer/issues. All complaints will be reviewed and investigated promptly and fairly.