Skip to content

Conversation

@bybabek
Copy link

@bybabek bybabek commented Aug 27, 2025

Add Custom Flutter Build Arguments Support

🚀 Features Added

  • WebAssembly Support: --wasm flag for high-performance web builds
  • Build Modes: Support for --profile and --debug builds alongside default --release
  • Custom Arguments: --build-arg option for any additional Flutter build flags
  • Enhanced CLI: Improved help text with examples and usage patterns

🔧 Changes Made

Files Modified:

  • lib/src/config.dart - Added buildArgs field
  • bin/web_cache_killer.dart - Enhanced CLI argument parsing
  • lib/services/build_service.dart - Dynamic build args support (already updated)
  • Version bumped to 0.0.4

New CLI Options:

--wasm                  # Enable WebAssembly compilation
--profile              # Build in profile mode for performance analysis  
--debug                # Build in debug mode for development
--build-arg="<arg>"    # Add custom build arguments (repeatable)
📝 Usage Examples
bash# WebAssembly build
web_cache_killer --wasm

# Profile build with WASM
web_cache_killer --wasm --profile

# Debug build
web_cache_killer --debug

# Custom build arguments
web_cache_killer --build-arg="--tree-shake-icons" --build-arg="--dart-define=ENV=prod"

# Complex example
web_cache_killer --wasm --profile --name=beta --auto-upload --verbose
✅ Testing Done

 Default release builds work unchanged (backward compatibility)
 WASM builds generate correct flutter build web --release --wasm commands
 Profile and debug modes work correctly
 Custom build arguments are passed through properly
 Verbose logging shows exact build commands
 Help text displays correctly with new options
 Error handling for conflicting build modes

🔍 Motivation
This addresses the need for modern Flutter web development workflows that require:

WebAssembly compilation for better performance ([Flutter WASM support](https://docs.flutter.dev/platform-integration/web/wasm))
Profile builds for performance debugging with Chrome DevTools
Debug builds for development and testing
Flexibility to pass any Flutter build arguments

🛡️ Backward Compatibility

All existing commands continue to work unchanged
Default behavior remains --release mode
No breaking changes to existing workflows

📋 Checklist

 Code follows project style guidelines
 Self-review completed
 Functionality tested on Windows
 Documentation updated (help text)
 Version number incremented
 Backward compatibility maintained

🎯 Related Issues
Resolves: Enhanced Flutter web build flexibility
Addresses: Support for modern Flutter web development patterns

Ready for review! 🚀

- Add --wasm flag for WebAssembly builds
- Add --profile and --debug build modes
- Add --build-arg for custom build arguments
- Maintain backward compatibility with default --release
- Add comprehensive CLI help and examples
- Update version to 0.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant