get method

Future get(
  1. String endpoint, {
  2. Map<String, dynamic> query = const {},
})

GET: Sends a GET request to the specified endpoint with optional query parameters.

Returns the response data on success, or handles errors using _handleError.

endpoint: The API endpoint to send the GET request to. query: Optional query parameters to include in the request.

Implementation

Future<dynamic> get(String endpoint, {Map<String, dynamic> query = const {}}) async {
  try {
    final response = await _dio.get(endpoint, queryParameters: query);
    return response.data;
  } catch (e) {
    return _handleError(e);
  }
}