Skip to content

Latest commit

 

History

History
 
 

http2_adapter

dio_http2_adapter

Pub

An HTTP/2 adapter for dio.

Getting Started

Install

dependencies:
  dio_http2_adapter: ^2.0.0 # latest version

Usage

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

void main() async {
  final dio = Dio()
    ..options.baseUrl = 'https://pub.dev'
    ..interceptors.add(LogInterceptor())
    ..httpClientAdapter = Http2Adapter(
      ConnectionManager(
        idleTimeout: 10000,
        // Ignore bad certificate
        onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
      ),
    );
  final response = await dio.get('/?xx=something');
  print(response.data?.length);
  print(response.redirects.length);
  print(response.data);
}