get method

  1. @override
Future<HttpResponse> get(
  1. String url,
  2. {Map<String, String>? headers,
  3. Map<String, String>? queryParameters}
)
override

Sends a GET request to the specified url.

Optionally, you can specify custom headers and queryParameters.

Returns a Future that completes with an HttpResponse when the request is complete.

Implementation

@override
Future<HttpResponse> get(String url,
    {Map<String, String>? headers,
    Map<String, String>? queryParameters}) async {
  log.fine("Sending GET request to $url");

  var r = await dio.get(url,
      queryParameters: queryParameters, options: Options(headers: headers));

  log.fine(
      "GET request to $url returned ${r.statusCode} ${r.data.toString()}");

  return HttpResponse(statusCode: r.statusCode, body: r.data);
}