delete method
DELETE:
Sends a DELETE request to the specified endpoint with an optional body.
Returns the response data on success, or handles errors using _handleError.
endpoint: The API endpoint to send the DELETE request to.
body: Optional data to include in the DELETE request body.
Implementation
Future<dynamic> delete(String endpoint, {dynamic body}) async {
try {
final response = await _dio.delete(endpoint, data: body != null ? jsonEncode(body) : null);
return response.data;
} catch (e) {
return _handleError(e);
}
}