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