Future<HttpClientRequest> createRequest(String method, String url, { Map<String, String> headers })

Creates an HttpClientRequest with the given parameters. method is the HTTP method. url is the URL to make the request to. headers specifies additional headers to set.

Source

static Future<HttpClientRequest> createRequest(
  String method,
  String url, {
    Map<String, String> headers
  }) async {
  var request = await client.openUrl(method, Uri.parse(url));
  if (headers != null) {
    headers.forEach(request.headers.set);
  }
  return request;
}