putRequest method
Make put request to api
Returns Map of the response. Throws an ApiException if the request is unsuccessful.
Implementation
Future<Map> putRequest(String path, {Map<String, dynamic>? body}) async {
final uri = getCausesApiPath(path);
print(
"Making request: ${uri.toString()}, body: $body, headers: ${getRequestHeaders()}");
http.Response response = await client.put(
uri,
headers: getRequestHeaders(),
body: json.encode(body),
);
if (response.statusCode >= 400) {
throw getExceptionForResponse(response);
}
return await json.decode(response.body);
}