patch method

Future patch(
  1. String endpoint,
  2. dynamic body
)

Sends a PATCH request to the specified endpoint with the provided body as JSON.

Returns the response data if the request is successful. If an error occurs, it is handled by _handleError.

endpoint: The API endpoint to send the PATCH request to. body: The data to be sent in the request body, which will be JSON-encoded.

Implementation

Future<dynamic> patch(String endpoint, dynamic body) async {
  try {
    final response = await _dio.patch(endpoint, data: jsonEncode(body));
    return response.data;
  } catch (e) {
    return _handleError(e);
  }
}