Skip to content
pubscout

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.

Rock solid
$ flutter pub add native_dio_adapter
Source repository

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.

  • talker_dio_logger

    A lightweight, customizable logger for Dio HTTP client built on Talker.

  • sentry_dio

    Adds Sentry performance tracing and error capture to Dio HTTP requests.

  • alice_dio

    Dio interceptor and network logger for Alice network inspector UI

Works with

Packages commonly used together with native_dio_adapter: ones it builds on, ones built on it, and its own family.