patch method
Future<Response>
patch(
{ - required String path,
- Map<String, dynamic>? queryParameters,
- Map<String, dynamic>? body,
- String contentType = 'application/json',
- void onSendProgress(
- int,
- int
)?,
- void onReceiveProgress(
- int,
- int
)?,
})
Implementation
Future<Response<dynamic>> patch({
required String path,
Map<String, dynamic>? queryParameters,
Map<String, dynamic>? body,
Map<String, dynamic>? headers,
String contentType = 'application/json',
void Function(int, int)? onSendProgress,
void Function(int, int)? onReceiveProgress,
}) 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 Patch REQUEST================');
debugPrint('REQUEST BODY: $body');
try {
final response = await dioClient.patch<dynamic>(
path,
queryParameters: queryParameters,
options: options,
data: requestBody,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
debugPrint('================DioClientExtended Patch RESPONSE================');
debugPrint('STATUS CODE: ${response.statusCode}');
debugPrint('DATA: ${response.data}');
return response;
} on DioException catch (e) {
debugPrint('DioException: $e');
rethrow;
}
}