delete method
Deletes the document referred to by this DocumentReference.
Implementation
Future delete() async {
// if we don't have the document ID, get it first.
if (id == null) _id = (await this.get())?.id;
if (_id == null) return; // early out if this document does not exist
http.Response response = await http
.delete(Uri.parse(Uri.encodeFull(documentUri)), headers: headers);
int httpStatusCode = response.statusCode;
if (httpStatusCode == HttpStatus.ok)
return;
else {
final Map<String, dynamic> responseJson = json.decode(response.body);
throw CarpServiceException(
httpStatus: HTTPStatus(httpStatusCode, response.reasonPhrase),
message: responseJson["message"],
path: responseJson["path"],
);
}
}