feat: Add support for dynamic Flutter build arguments#53
Closed
myavuzokumus wants to merge 5 commits into
Closed
Conversation
Refactors the Flutter build process to allow any argument from the `flutter build windows` command to be passed through the CLI. This change introduces a more flexible and scalable architecture by: - Modifying `FlutterBuilder` to accept a dynamic map of arguments. - Adding a predefined list of passthrough options in `inno_build.dart` to easily manage and extend supported arguments. - Updating `ArgParser` in the main executable to include new options like `--obfuscate`, `--split-debug-info`, and `--dart-define`. This enables crucial features like code obfuscation and compile-time variable definitions, making the tool suitable for more professional and secure production builds.
izzalDev
reviewed
Aug 16, 2025
# Conflicts: # bin/inno_build.dart
izzalDev
requested changes
Aug 20, 2025
izzalDev
left a comment
Owner
There was a problem hiding this comment.
Dear @myavuzokumus
Thanks for your idea—it's very interesting. However, I belive it would be more dynamic and efficient to directly passthrough the flutter build windows arguments to the Flutter SDK. For example:
dart run inno_build [inno-build-options] -- [flutter-build-windows-options]With this approach, any changes in the Flutter SDK will be automatically adapted by the program, without need to changes this code and manually parse each argument.
Note: You can use rest property from ArgParser instance to capture options that are not explicitly listed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces a major enhancement by adding support for dynamic
flutter build windowsarguments. Users can now pass arguments like--obfuscate,--split-debug-info, and--dart-definedirectly through theinno_buildcommand line.This resolves the limitation of the previous implementation, which only supported
--debugand--releaseflags, and enables users to leverage the full power of Flutter's build capabilities for professional production builds.Outline of the changes
FlutterBuilderRefactored: TheFlutterBuilderservice is no longer limited to a few fixed parameters. It now accepts aMap<String, dynamic>of arguments, which it dynamically appends to theflutter buildcommand.InnoBuildclass now intelligently collects all Flutter-related arguments passed to the CLI and forwards them to theFlutterBuilder._flutterBuildOptions, has been added to make it trivial to add support for new Flutter arguments in the future without changing the core logic.ArgParserhas been updated to officially support:--obfuscate--split-debug-info=<path>--dart-define=<key=value>(can be used multiple times)--target=<path>How to use
After these changes, users can build their applications with advanced options:
Example 1: Build with obfuscation
This contribution significantly increases the utility and professionalism of the package.