flutter_app_size_reducer 1.0.3 copy "flutter_app_size_reducer: ^1.0.3" to clipboard
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 #

pub package License: MIT CI codecov

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:

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.

3
likes
145
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for analyzing and reducing app size through CLI commands.

Repository (GitHub)
View/report issues
Contributing

Topics

#flutter #cli #assets #optimization #tools

Documentation

API reference

License

MIT (license)

Dependencies

args, console_bars, flutter, image, path, yaml

More

Packages that depend on flutter_app_size_reducer