getAsync method

Future<HttpResponse> getAsync(
  1. String url, [
  2. HttpRequest? options
])

Issues an HTTP GET request to the specified URL, returning a Future that resolves with an HttpResponse representing the result.

url The URL for the request. options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter. Returns a Future that resolves with an HttpResponse describing the response, or rejects with an Error indicating a failure.

Implementation

Future<HttpResponse> getAsync(String url, [HttpRequest? options]) {
  options ??= HttpRequest();
  options.method = 'GET';
  options.url = url;
  return sendAsync(options);
}