Skip to content
pubscout

dio_http2_adapter

2.9.0, released 3 months ago by flutter.cn

HTTP/2 adapter for Dio with connection reuse and header compression

$ flutter pub add dio_http2_adapter
Source repository

What it does

Provides an HTTP/2 client adapter for the Dio HTTP client. It manages connection pooling, header compression, and supports fallbacks to HTTP/1.1 when necessary. It also offers configuration for timeouts, proxies, and bad certificate handling.

AI-written summary of version 2.9.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need HTTP/2 support in a Dio-based app
  • You want connection reuse and header compression for performance
  • You need to customize TLS or proxy settings for Dio

Skip it when

  • You are not using Dio as your HTTP client
  • You only need basic HTTP/1.1 functionality
  • You prefer a pure Dart HTTP client like http

Strengths

  • Built on top of Dio, so integrates seamlessly with existing Dio code
  • Supports connection reuse and header compression for efficient traffic
  • Provides fallback to HTTP/1.1 and configurable protocols
  • Offers detailed configuration for timeouts, proxies, and bad certificates

Weaknesses

  • Only works with Dio, not a standalone HTTP client
  • Requires Dio dependency
  • Limited to HTTP/2 and HTTP/1.1, no other protocols

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
3

Add to pubspec dependencies and set `dio.httpClientAdapter = Http2Adapter(...)` in code

import 'package:dio/dio.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';

final dio = Dio()..httpClientAdapter = Http2Adapter();

Future<void> main() async {
  final response = await dio.get('https://example.com');
  print(response.data);
}

Alternatives

Packages that do the same job and could replace dio_http2_adapter.

  • talker_dio_logger

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

  • http

    A composable, Future‑based library for making HTTP requests across platforms.

  • nm

    Client for interacting with Linux NetworkManager via D-Bus

  • alice_dio

    Dio interceptor and network logger for Alice network inspector UI

Works with

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