delete method
Delete a data point with the given id
.
Returns on success. Throws a CarpServiceException if data point is not found or otherwise unsuccessful.
Implementation
Future<void> delete(int id) async {
final url = "$dataEndpointUri/$id";
final response = await service._delete(url);
final int httpStatusCode = response.statusCode;
if (httpStatusCode == HttpStatus.ok) return;
// All other cases are treated as an error.
final Map<String, dynamic> responseJson =
json.decode(response.body) as Map<String, dynamic>;
throw CarpServiceException.fromMap(httpStatusCode, responseJson);
}