A composable, Future-based library for making HTTP requests.

pub package Build Status

This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's platform-independent, and can be used on both the command-line and the browser.



import 'package:http/http.dart' as http;

var url = 'http://example.com/whatsit/create';
var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'});

print(await http.read('http://example.com/foobar.txt'));


var client = new http.Client();
try {
  var uriResponse = await client.post('http://example.com/whatsit/create',
  print(await client.get(uriResponse.bodyFields['uri']));
} finally {



class UserAgentClient extends http.BaseClient {
  final String userAgent;
  final http.Client _inner;

  UserAgentClient(this.userAgent, this._inner);

  Future<StreamedResponse> send(BaseRequest request) {
    request.headers['user-agent'] = userAgent;
    return _inner.send(request);