get method

Future<Response> get({
  1. required String path,
  2. void onReceiveProgress(
    1. int,
    2. int
    )?,
  3. Map<String, dynamic>? queryParameters,
  4. String contentType = 'application/json',
  5. Map<String, dynamic>? headers,
})

Implementation

Future<Response<dynamic>> get({
  required String path,
  void Function(int, int)? onReceiveProgress,
  Map<String, dynamic>? queryParameters,
  String contentType = 'application/json',
  Map<String, dynamic>? headers,
}) async {
  //holds request options
  final options = headers != null
      ? Options(
    responseType: ResponseType.json,
    contentType: contentType,
    headers: headers,
  )
      : Options(
    responseType: ResponseType.json,
    contentType: contentType,
  );

  debugPrint('================DioClientExtended Get REQUEST================');
  // debugPrint('REQUEST BODY: $body');
  try {
    final response = await dioClient.get<dynamic>(
      path,
      queryParameters: queryParameters,
      onReceiveProgress: onReceiveProgress,
      options: options,
    );

    debugPrint('================DioClientExtended Get RESPONSE================');
    debugPrint('STATUS CODE: ${response.statusCode}');
    debugPrint('DATA: ${response.data}');
    return response;
  } on DioException catch (e) {
    debugPrint('DioException: $e');
    rethrow;
  }
}