openUrl method

Future<HttpClientRequest> openUrl(
  1. String method,
  2. Uri url
)

Opens a url using a method like GET, PUT, POST, HEAD, PATCH, DELETE.

Returns a Future of HttpClientRequest.

Implementation

Future<HttpClientRequest> openUrl(String method, Uri url) {
  return Future(() {
    if (_stop) {
      throw Exception("Client is closed. Can't open new connections");
    }
    _requests.add(
        HttpClientRequestImpl(url, method, _cronetEngine, _cleanUpRequests));
    return _requests.last;
  });
}