Skip to content
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

Dio 5.5 broke compilation for WASM #2266

Closed
vaind opened this issue Jul 4, 2024 · 6 comments · Fixed by #2267
Closed

Dio 5.5 broke compilation for WASM #2266

vaind opened this issue Jul 4, 2024 · 6 comments · Fixed by #2267
Labels
b: regression Worked before but not now fixed p: dio Targeting `dio` package platform: web s: bug Something isn't working

Comments

@vaind
Copy link

vaind commented Jul 4, 2024

Package

dio

Version

5.5.0

Operating-System

Web

Adapter

Default Dio

Output of flutter doctor -v

Flutter 3.22.2

Dart Version

No response

Steps to Reproduce

  1. flutter create dio_web
  2. cd dio_web
  3. flutter pub add dio:5.4.3+1
  4. Add some dio code to lib/main.dart, e.g.
void main() async {
  final dio = Dio();
  final response = await dio.get('https://dart.dev');
  runApp(const MyApp());
}
  1. flutter build web --wasm succeeds now
  2. flutter pub add dio:5.5.0
  3. flutter build web --wasm fails now

Expected Result

Minor version bumps don't break existing users.

Actual Result

Latest release broke users who already use wasm (or test against it, e.g. getsentry/sentry-dart)

Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64:
*NOTE*: Compilation to WasmGC is experimental.
The support may change, or be removed, with no advance notice.


../../../.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:

    main.dart => package:dio_web => package:dio => package:dio_web_adapter => dart:html
...
@vaind vaind added h: need triage This issue needs to be categorized s: bug Something isn't working labels Jul 4, 2024
@AlexV525 AlexV525 added p: dio Targeting `dio` package b: regression Worked before but not now platform: web and removed h: need triage This issue needs to be categorized labels Jul 4, 2024
@kuhnroyal
Copy link
Member

@vaind Can you please try to run against https://github.com/kuhnroyal/dio/tree/fix/wasm-compile

@kuhnroyal
Copy link
Member

While your tests previously compiled for some reason, the dio package does not yet support WASM. So I don't fully grasp how the tests were successful.

@kuhnroyal
Copy link
Member

The test seem to run now.
@AlexV525 We can probably publish this as +1 and should be fine?

@vaind
Copy link
Author

vaind commented Jul 4, 2024

v5.4 worked just fine with WASM (verified in an actual web app locally). I assume it depends on what code ends up being tree-shaken or not.

@kuhnroyal
Copy link
Member

Interesting, I have not looked very much into WASM yet.
Since we only have 2 default adapters and the dart:html based adapter is not working for WASM, that would mean that the io based adapter was compiled to WASM 🤔

@AlexV525
Copy link
Member

AlexV525 commented Jul 4, 2024

@vaind Hopefully you'll get all passed tests after upgrading dio to v5.5.0+1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b: regression Worked before but not now fixed p: dio Targeting `dio` package platform: web s: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants