dio_http2_adapter
2.9.0, released 3 months ago by flutter.cn
HTTP/2 adapter for Dio with connection reuse and header compression
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.
92Compare - http
A composable, Future‑based library for making HTTP requests across platforms.
86Compare - nm
Client for interacting with Linux NetworkManager via D-Bus
81Compare - alice_dio
Dio interceptor and network logger for Alice network inspector UI
82Compare
Works with
Packages commonly used together with dio_http2_adapter: ones it builds on, ones built on it, and its own family.
- diodio_http2_adapter depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- http2dio_http2_adapter depends on itAn HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.
- 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.
- native_dio_adapterSame familyA Dio HTTP client adapter that uses native platform HTTP stacks via cupertino_http and cronet_http.