-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Is it now possible to use DIO / dio_web_adapter with Web/WASM? #2265
Comments
It does. We're pushing it to convert to the |
This error started popping up with the latest Dio release and broke our build/tests in getsentry/sentry-dart. AFAICT, adding the dependency on package web_adapter was a breaking change and should have been a major release (Dio 6.0), not a minor one (Dio 5.5) |
Can you elaborate on the details? Please submit an issue at getsentry/sentry-dart and ping me so we can track specific problems. This thread should focus on WASM support.
Nope. We intended to make this not a breaking change and the package is still embedded with the |
This is breaking for people who were alerady building for WASM, because |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
This is not an issue in sentry-dart. Your package added a dependency on a noncompatible package. I'll create a new issue. |
@vaind What are you talking about? They created ../../.pub-cache/hosted/pub.dev/dio-5.4.3+1/lib/src/adapters/browser_adapter.dart:3:8: Error: Dart library 'dart:html' is not available on this platform.
import 'dart:html'; |
@AlexV525 while we're here, how do you plan on dealing with the possibility of needing to update |
AFAICT it does allow. But maybe it's been changed. |
Holy crap it totally does. I did not expect that. |
why wouldn't it? it's another major version - it's pretty normal to have releases on multiple major versions |
Depends on what you're using from Dio. See #2266 |
Judging by your sample, with no specific adapter configuration, it seems that the default IO adapter is used for the WASM compile. Which does not really make sense to me, why would that work? I mean I can see that it compiles but.... |
I guess that the WASM env is compatible with the compilation of |
That might be a bug in the WASM compiler |
The compiled code works fine: the request is executed successfully. |
So from what I read, |
What is the status of |
I am interested in some feedback on the usage of the |
Apps can build but you can't actually make any calls main.dart.mjs:19 DioException [unknown]: null
Error: Unsupported operation: Platform._version
main.dart.mjs:19 at _DioForNative&Object&DioMixin.fetch inner (http://localhost:49762/main.dart.wasm:wasm-function[1369]:0x4a870)
at _awaitHelper closure at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:85:15 (http://localhost:49762/main.dart.wasm:wasm-function[2508]:0x6113a)
at closure wrapper at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:85:15 trampoline (http://localhost:49762/main.dart.wasm:wasm-function[2514]:0x611a6)
at _RootZone.runBinary (http://localhost:49762/main.dart.wasm:wasm-function[949]:0x42673)
at _FutureListener.handleError (http://localhost:49762/main.dart.wasm:wasm-function[948]:0x425c2)
at _Future._propagateToListeners closure handleError at org-dartlang-sdk:///dart-sdk/lib/async/future_impl.dart:868:25 (http://localhost:49762/main.dart.wasm:wasm-function[914]:0x41ee1)
at _Future._propagateToListeners (http://localhost:49762/main.dart.wasm:wasm-function[910]:0x41ad0)
at _Future._completeError (http://localhost:49762/main.dart.wasm:wasm-function[1004]:0x43015)
localhost/:1 Uncaught Exception |
We have same issue in our project. Apps can build in wasm mode but there are no actually performing any calls. Any updates about status of |
@vaind How did you test your requests? |
by checking the response |
Idk what call you're making but |
@vaind are you 100% sure your app is running with the WASM renderer? There are very specific header and browser requirements. |
see my repro here where I've tested it with dio 5.4 #2266 - you can give it a try and print out the the response, to see if it actually works. I remember it worked, although I have no need for dio/wasm personally so that repro was just to get the plugin fixed to unbreak my builds elsewhere |
Can you check the value of |
Sorry, I don't have the environment to do that anymore but you can try it yourself with the given example. Or just wait until official wasm support lands in Dio |
Your example is pretty much what I created myself
Your claims that requests work when compiled to WASM seem to be what is blocking work on that support
In the future please check the value of |
I'll do that. Maybe it just falled back on .js or something. As I've said, I have no need for wasm+dio so I didn't looked too much into it and I must have gotten fooled by it showing stuff when I launched the built app. |
@kuhnroyal Is there existing work on |
I think some initial work was done in #2218 but we had to split the adapter first. Feel free to create a PR 👍 |
The implementation has already been setup with
Self-assigned since I've already done most of the work. This could be pushed in the next few days, I've been through a busy month recently :). |
@AlexV525 Thank you! I need this soon for an upcoming project, so if you need any help with the migration or testing please let me know! |
For personal usages I'd recommend to easily fork and update the code like this: https://github.com/cfug/dio/pull/2274/files |
Yes that would work as a last resort, but I'd rather not start a new project with a bunch of self-hosted dependencies if I can avoid it |
or rely on this ref-based dependency: e247bd0 |
Will the 'dio_web_adapter' v2 support SSE (Streaming) ? |
Any update about release of this version of dio? |
We've published dio v5.6.0 and dio_web_adapter v2.0.0 to support the WASM environment. Please submit separate issues regarding specific implementations if any. |
Request Statement
$ flutter build web --wasm
I get this error:
.pub-cache/hosted/pub.dev/dio_web_adapter-1.0.1/lib/src/html/adapter.dart:5:8: Error: Dart library 'dart:html' is not available on this platform.
import 'dart:html';
^
Context: The unavailable library 'dart:html' is imported through these packages:
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: