delete method
Implementation
Future<Response<dynamic>> delete({
required String path,
Map<String, dynamic>? queryParameters,
Map<String, dynamic>? body,
Map<String, dynamic>? headers,
String contentType = 'application/json; charset=UTF-8',
}) async {
final requestBody = jsonEncode(body);
//holds request options
final options = headers!=null? Options(
responseType: ResponseType.json,
contentType: contentType,
headers: headers
):Options(
responseType: ResponseType.json,
contentType: contentType,
);
debugPrint('================DioClientExtended Delete REQUEST================');
debugPrint('REQUEST BODY: $body');
try {
final response = await dioClient.delete<dynamic>(
path,
queryParameters: queryParameters,
options: options,
data: requestBody,
);
debugPrint('================DioClientExtended Delete RESPONSE================');
debugPrint('STATUS CODE: ${response.statusCode}');
debugPrint('DATA: ${response.data}');
return response;
} on DioException catch (e) {
debugPrint('DioException: $e');
rethrow;
}
}