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

[native_dio_adapter] Pre-defined URLSessionConfiguration will fail platforms other than Darwin #2039

Closed
AlexV525 opened this issue Nov 25, 2023 · 0 comments · Fixed by #2040
Labels
fixed p: native_dio_adapter Targeting `native_dio_adapter` package s: bug Something isn't working

Comments

@AlexV525
Copy link
Member

Package

native_dio_adapter

Version

1.1.1

Operating-System

Android

Output of flutter doctor -v

No response

Dart Version

No response

Steps to Reproduce

Run the below code on Android:

final dio = Dio();
dio.httpClientAdapter = NativeAdapter(
  cupertinoConfiguration:
      URLSessionConfiguration.ephemeralSessionConfiguration()
        ..allowsCellularAccess = false
        ..allowsConstrainedNetworkAccess = false
        ..allowsExpensiveNetworkAccess = false,
);

Expected Result

No exceptions were thrown.

Actual Result

E/flutter (14736): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Platform android is not supported
E/flutter (14736): #0      linkedLibs.<anonymous closure> (package:cupertino_http/src/utils.dart:22:3)
E/flutter (14736): #1      linkedLibs (package:cupertino_http/src/utils.dart:24:2)
E/flutter (14736): #2      linkedLibs (package:cupertino_http/src/utils.dart)
E/flutter (14736): #3      new URLSessionConfiguration.ephemeralSessionConfiguration (package:cupertino_http/src/cupertino_api.dart:191:15)
E/flutter (14736): #4      _MyHomePageState._doGetRequest (package:example/main.dart:78:35)
@AlexV525 AlexV525 added p: native_dio_adapter Targeting `native_dio_adapter` package s: bug Something isn't working labels Nov 25, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 25, 2023
…Configuration` (#2040)

...to deprecate `cronetEngine` and `cupertinoConfiguration` for the
`NativeAdapter`, to avoid platform exceptions.

Fixes #2039.

### New Pull Request Checklist

- [x] I have read the
[Documentation](https://pub.dev/documentation/dio/latest/)
- [x] I have searched for a similar pull request in the
[project](https://github.com/cfug/dio/pulls) and found none
- [x] I have updated this branch with the latest `main` branch to avoid
conflicts (via merge from master or rebase)
- [ ] I have added the required tests to prove the fix/feature I'm
adding
- [x] I have updated the documentation (if necessary)
- [x] I have run the tests without failures
- [x] I have updated the `CHANGELOG.md` in the corresponding package
@AlexV525 AlexV525 added the fixed label Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed p: native_dio_adapter Targeting `native_dio_adapter` package s: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant