New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build hook for Flutter Web? #138992
Comments
Why? This could be as cheap as |
@jonahwilliams Thanks for the good question! There may be some cases, for example:
Personally speaking, I want to make V2 of https://github.com/fzyzcjy/flutter_rust_bridge as convenient to use as possible. |
We need this |
Flutter's web build tool is pretty simple. It knows how to build the Flutter bits, but it has no opinion about how to build anything other than Flutter. Unlike the Android toolchain, which includes gradle, our web tools do not include any fancy build systems, like NPM, WebPack, etc. If you need to combine Flutter Web with non-Flutter code, I think the best place to put that functionality is above Flutter, rather than inside it. For example, you could use |
cc @dcharkes who is working on something related |
Yes, I envision having an asset type "wasm" in the future, which would then be consumed by the flutter tooling. Flutter web should then start invoking I had some discussions with @eyebrowsoffire about this recently. Some notes can be found in: Some earlier issues filed relevant for this:
I was having a similar discussion recently with @mosuem in our quest of adding tree-shakable data assets to Dart/Flutter (dart-lang/native#153). The web frameworks on Dart all wrap dart2js or dart2wasm and don't have a full bundle format. So we need to do some exploration on how to address that. (E.g. lazy loading, modules, where are WASM modules hosted etc.) |
Get it, thank you! |
Thank you for filing this. I am going to close this however, as given the work with native assets and yjbanov's point about composing complex web builds with some higher level tool, I don't think we would accept a proposal for ANOTHER way to do this. |
You are welcome, and also thank you all! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Is there an existing issue for this?
Use case
Hi thanks for the great framework! When developing https://github.com/fzyzcjy/flutter_rust_bridge v2, we are having the following scenario: We need to compile some Rust code into WASM, which is used by Flutter code.
For the native platforms, the build can be invoked easily. For example, in Android, we can just modify the build.gradle and let it invoke the build commands; similar for iOS, windows, macos, linux. However, IMHO there is no place to inject such "hooks" when building.
Surely, we can just create another tool that wraps the "build rust + call flutter run" process (that's what we are doing currently) - but that looks suboptimal.
I guess it is somehow related to the native assets dart-lang/sdk#50565 / #129757, but this is just a (small) part of what native asset system is going to cover, and seems to be also possibly orthogonal (e.g. today's Android/iOS/... build hook can be implemented, but without native assets), so I make a separate issue here.
Proposal
(see above)
The text was updated successfully, but these errors were encountered: