-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
[wasm] TypeError #40
Comments
I've committed 7e951e7 to tentatively fix your issue... according to the stack trace, it happens on line 68 in lib/src/_impl/web/_channel.dart, where something like Could you post the generated code from |
Also, I understand you compiled your Flutter app to Web Assembly, but did you also compile workers to Web Assembly? |
At least, this fix made test "- Squadron Worker - initialization error - not found" pass again :-) Thanks! |
Scenario 1: CodecService @SquadronService(baseUrl: '/services/codec', wasm: false) // Raises runtime exception TypeError (this issue)
@SquadronService(baseUrl: '/services/codec', wasm: true) // No error but I would get on to scenario 2 Scenario 2: WebSocketService @SquadronService(baseUrl: '/services/websocket', wasm: true) // Another issue but no exception For wasm: false (default): dart compile js codec_service.web.g.dart -o codec_service.web.g.dart.js For wasm: true: dart compile wasm codec_service.web.g.dart -o codec_service.web.g.dart.wasm I don't know how to explain scenario 2 because there is no exception, but I don't receive WebSocket messages in a Stream. I will open another issue if this issue resolves first. |
Flutter app does runtime check to see if the browser supports wasm. How will squadron manage to do the same ? For js app, load js worker and for wasm app, load wasm worker ? Do I have to dual compile ? dart compile js codec_service.web.g.dart -o codec_service.web.g.dart.js
dart compile wasm codec_service.web.g.dart -o codec_service.web.g.dart.wasm |
I had to change the extension to .txt to upload it here. |
Thanks for the file, I don't think the error comes from the generated code. What output do you have in your browser's console logs? |
The logs I shared on the first post is from the browser console when the app is launched and some action is performed. The app compiles to wasm sucessfully. So, no compilation error. |
Yes, you'd have to dual compile AND implement any logic you need to serve JS or wasm. I believe you'd also have to copy the files generated by It's an interesting feature, I'll keep that in mind once everything wasm is sorted out. |
Version 6 is available, please refer to Squadron's changelog for breaking changes. Provided you dual-compile, this enables choosing Js or Wasm workers. Eg if your service is called |
Btw did you manage to solve the initial problem you reported? If so, can you close this issue? |
I am migrating to v6.0.1 from pub.dev with squadron builder v6.0.0 But I am getting "Missing import of squadron library" errors when using build_runner build command It seems the compiler is complaining every other non-squadron releated files to be generated like riverpod providers and freezed data models to also have squadron imported. The errors are "Missing Dart types: FutureOr, Future, Stream" and "Missing import of squadron library" |
The build_runner issue should be fixed now, please upgrade squadron_builder to |
"Missing import of squadron library" - Fixed "Missing Dart types: FutureOr, Future, Stream" - Not fixed (Still getting error even though the squadron method returns a Future or Stream) Looking at the examples of squadron builder, is using prefix necessary for Future and Streams ? Some use prefix from dart:async and some from dart:core. Why is that ? |
No prefix required, these are tests related to issue d-markey/squadron_builder#14 As a workaround, could you try to change (at least one of) your methods to return FutureOr instead of Future? It may be related to dart:core exporting Future and Stream from dart:async, but not FutureOr. So I believe this would work for the meantime, until I find a fix (which may take a little time...) |
It worked. Thanks! The build runner issue is gone. About the original issue, I believe it is resolved because I modified my code to use type casting. Previously it used to work in js environment, so I assumed it as squadron bug. I do not get any logs on console which I reported on this original thread.
|
The same code works as expected when my flutter app is compiled to javascript but when I compile it to wasm, I get the following error:
Pubspec.yaml
The text was updated successfully, but these errors were encountered: