native_dio_adapter
1.8.0, released 4 months ago by flutter.cn
A Dio HTTP client adapter that uses native platform HTTP stacks via cupertino_http and cronet_http.
What it does
It replaces Dio's default HttpClientAdapter with a native implementation, delegating requests to the platform's networking APIs. It supports Cronet fallback and embedded Cronet on Android.
AI-written summary of version 1.8.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need Dio but want native networking features like VPN, HTTP/3, or proxy support
- You target iOS, macOS, Android and want platform‑specific networking behavior
Skip it when
- You require a pure Dart implementation for all platforms
- You need a lightweight HTTP client without Dio overhead
Strengths
- Leverages native networking stacks for better performance and feature support
- Provides Cronet fallback and embedded Cronet options
- Works transparently with existing Dio code
Weaknesses
- Only works on platforms with native support; other platforms fall back to Dart http
- Adds native dependencies and potential build complexity
- Requires minimum Flutter 3.35.6 and Dart 3.4.0
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 5
Add the package to pubspec, ensure Flutter version >=3.35.6, and on Android configure Cronet if using embedded Cronet via dart-define. No extra code generation needed.
final dio = Dio();
dio.httpClientAdapter = NativeAdapter();Alternatives
Packages that do the same job and could replace native_dio_adapter.
- http2
An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.
91Compare - talker_dio_logger
A lightweight, customizable logger for Dio HTTP client built on Talker.
92Compare - sentry_dio
Adds Sentry performance tracing and error capture to Dio HTTP requests.
93Compare - alice_dio
Dio interceptor and network logger for Alice network inspector UI
82Compare
Works with
Packages commonly used together with native_dio_adapter: ones it builds on, ones built on it, and its own family.
- jninative_dio_adapter depends on itProvides Dart/Flutter bindings to call native Java code via JNI.
- dionative_dio_adapter depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- cupertino_httpnative_dio_adapter depends on itmacOS/iOS Flutter plugin providing access to the Foundation URL Loading System.
- cronet_httpnative_dio_adapter depends on itAn Android Flutter plugin providing access to the Cronet HTTP client.
- dio_web_adapterSame familyWeb and WASM HTTP client adapter for Dio.
- dio_cookie_managerSame familyA cookie manager for Dio combining cookie_jar and Dio based on the interceptor algorithm.
- dio_http2_adapterSame familyHTTP/2 adapter for Dio with connection reuse and header compression
- flutter_video_cachingBuilt on native_dio_adapterVideo caching and local proxy server for Flutter video playback