open method

Future<HttpClientRequest> open (
  1. String method,
  2. String host,
  3. int port,
  4. String path
)

Opens a HTTP connection.

The HTTP method to use is specified in method, the server is specified using host and port, and the path (including a possible query) is specified using path. The path may also contain a URI fragment, which will be ignored.

The Host header for the request will be set to the value host:port (if host is an IP address, it will still be used in the Host header). This can be overridden through the HttpClientRequest interface before the request is sent.

For additional information on the sequence of events during an HTTP transaction, and the objects returned by the futures, see the overall documentation for the class HttpClient.

Implementation

Future<HttpClientRequest> open(
    String method, String host, int port, String path);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-io/HttpClient/open.html