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

BrowserHttpClientAdapter() error in web. #2282

Open
JemmyWang94 opened this issue Aug 14, 2024 · 6 comments
Open

BrowserHttpClientAdapter() error in web. #2282

JemmyWang94 opened this issue Aug 14, 2024 · 6 comments
Labels
i: out of support p: dio Targeting `dio` package p: web_adapter Targeting `web_adapter` package platform: web s: bug Something isn't working

Comments

@JemmyWang94
Copy link

Package

dio

Version

5.6.0

Operating-System

Web

Adapter

Default Dio

Output of flutter doctor -v

No response

Dart Version

3.5.0

Steps to Reproduce

BrowserHttpClientAdapter adapter = BrowserHttpClientAdapter();
adapter.withCredentials = true;
dio.httpClientAdapter = adapter;

Expected Result

no error and work well.

Actual Result

TypeError: Cannot read properties of undefined (reading 'new')
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ #0 fortex7/packages/fortexmobile/common/network/web/web_platform.dart.lib.js 18:57 createClientAdapter

in flutter 3.22.3, it work well

@JemmyWang94 JemmyWang94 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Aug 14, 2024
@JemmyWang94
Copy link
Author

flutter: 3.24.0

@AlexV525
Copy link
Member

Could you share the resolved version of dio and dio_web_adapter in your pubspec.lock?

@Dan-Crane
Copy link

Dan-Crane commented Aug 16, 2024

Hi bro, I also faced this error:

  dio:
    dependency: "direct main"
    description:
      name: dio
      sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0"
      url: "https://pub.dev"
    source: hosted
    version: "5.6.0"
  dio_web_adapter:
    dependency: transitive
    description:
      name: dio_web_adapter
      sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8"
      url: "https://pub.dev"
    source: hosted
    version: "2.0.0"

@AlexV525
Copy link
Member

I'm getting the normal result using the example in the repo: https://github.com/cfug/dio/tree/main/example_flutter_app

Could someone provide a standalone runnable minimal reproducible example?

@Dan-Crane
Copy link

Here is the code where I am encountering the error: link to code.

@AlexV525
Copy link
Member

It looks like a Dart bug, filed dart-lang/sdk#56498.

Meanwhile, a workaround could be:

HttpClientAdapter makeHttpClientAdapter() {
  final adapter = HttpClientAdapter() as BrowserHttpClientAdapter;
  adapter.withCredentials = true;
  return adapter;
}

@AlexV525 AlexV525 added p: dio Targeting `dio` package i: out of support platform: web p: web_adapter Targeting `web_adapter` package and removed h: need triage This issue needs to be categorized labels Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i: out of support p: dio Targeting `dio` package p: web_adapter Targeting `web_adapter` package platform: web s: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants