talira

http2 (Dart)

HTTP/2 implementation for Dart, with a pooled, multiplexing http.Client

open sourceBSD-3-Clausefree

http2 is the Dart team's HTTP/2 implementation on top of a bidirectional byte stream, for clients and servers. Its Http2Client is a package:http Client that pools and multiplexes requests over shared HTTP/2 connections instead of opening one connection per request, which dart:io's HTTP/1.1 HttpClient would do.

Problems it solves

  • my Dart app opens a new TLS connection for every request to the same API
  • make HTTP/2 requests from a Dart command-line app
  • multiplex many concurrent requests to one host in Dart

Features

  • HTTP/2 client and server transport over a bidirectional byte stream
  • Http2Client: a package:http Client that pools and multiplexes requests over shared HTTP/2 connections
  • one connection per host and port, reused across requests

Limitations

  • Http2Client speaks only HTTP/2 and doesn't fall back to HTTP/1.1: a server that doesn't negotiate h2 is an error.1

Alternatives

The same job

These do what http2 (Dart) does.

  1. dio HTTP client for Dart and Flutter with interceptors, FormData and cancellation
  2. cookie_jar A cookie manager for HTTP requests in Dart

Compare http2 (Dart) with the top 3