get method

Future<Response> get({
  1. required String endpoint,
  2. Map<String, dynamic>? headers,
  3. Map<String, dynamic>? queryParameters,
})

Sends a GET request to the specified endpoint.

  • endpoint: The API endpoint to which the GET request will be sent.
  • headers: Optional headers to include in the request.
  • queryParameters: Optional query parameters to include in the request.

Returns a Response object containing the server's response.

Throws UnAuthorizedException if the response status code is 401 (unauthorized). Throws FetchDataException for any other error response.

Implementation

Future<Response> get({
  required String endpoint,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? queryParameters,
}) async {
  Response response = await httpClient.request(
    endpoint,
    method: "GET",
  );

  return _processResponse(response);
}