Last updated:
0 purchases
native dio adapter
Native Dio Adapter #
Note: This uses the native http implementation on macOS, iOS and Android.
Other platforms still use the Dart http stack.
If you encounter bugs, consider fixing it by opening a PR or at least contribute a failing test case.
A client for Dio which makes use of
cupertino_http and
cronet_http
to delegate HTTP requests to the native platform instead of the dart:io platforms.
Inspired by the Dart 2.18 release blog.
Motivation #
Using the native platform implementation, rather than the socket-based
dart:io HttpClient implementation,
has several advantages:
It automatically supports platform features such VPNs and HTTP proxies.
It supports many more configuration options such as only allowing access through WiFi and blocking cookies.
It supports more HTTP features such as HTTP/3 and custom redirect handling.
Get started #
Install #
Add the native_dio_adapter package to your
pubspec dependencies.
Example #
final dioClient = Dio();
dioClient.httpClientAdapter = NativeAdapter();
copied to clipboard
📣 About the author #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.