-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
dart2wasm fails on Random.secure().nextInt() #55031
Comments
I'm not a pro for writing wasm interop code but it seems like
is missing a @pragma("wasm:import", "get_random_bytes") I found this docu about the wasm random: https://github.com/WebAssembly/wasi-random?tab=readme-ov-file#api-walk-through Also there are a lot of todos in the math class. Is it fully supported yet? @mkustermann You seem to be working on wasm. I would contribute, but it's quite hard to get into the code. Is there a guide how the wasm binding works with dart? |
Thank you for the bug report, @konsultaner ! This is a bug: It hasn't been implemented yet (the only We have a test for this: https://github.com/dart-lang/sdk/blob/main/tests/lib/math/random_secure_test.dart which is failing on dart2wasm atm.
Those TODOs aren't critical to address (in fact they come from the VM backend - which the wasm version was based on - I believe) Generally most things should be working in dart2wasm. There's a few things that aren't quite there yet (e.g. edge cases in async, #55025), which we'll work on in the coming weeks/months. Though please notice that dart2wasm is still experimental
Our main target for dart2wasm is the browser atm, which doesn't have WASI support. I think maybe something like this will do the trick. /cc @osa1 Could you implement |
Implemented in https://dart-review.googlesource.com/c/sdk/+/356040. |
@osa1 Should I close this issue as you implemented it? |
@konsultaner it's not ready yet. The issue will be automatically closed when it's merged. |
@osa1 which version of dart will have it included? |
@konsultaner the commit 1285976 was tagged as 3.4.0-dev so it will be included in 3.4.0. |
At the moment it is not possible to use the
Random.secure().nextInt()
method in conjunction with dart2wasm.this test running with
-p chrome -c dart2wasm
will output:
The text was updated successfully, but these errors were encountered: