get<T> method

  1. @override
Future<T> get<T>(
  1. String path,
  2. {Object? body,
  3. Map<String, dynamic>? queryParameters,
  4. Options? options}
)
override

Performs a GET request to the provided API URL and returns the response.

  • path: The URL for the GET request.
  • body: (optional) request body.
  • queryParameters: (optional) The query parameters for the GET request.
  • options: (optional) The options to be merged with the base options.

Returns a Future that completes with the response data of type T.

Throws a DioException if the request fails.

Implementation

@override
Future<T> get<T>(String path,
    {Object? body,
    Map<String, dynamic>? queryParameters,
    Options? options}) async {
  try {
    final response = await _dio.get<T>(
      path,
      data: body,
      queryParameters: queryParameters,
      options: options,
    );
    return response.data as T;
  } on DioException catch (e) {
    log("message: ${e.message}");
    rethrow;
  }
}