remove method
Removes the given resource.
Implementation
@override
Future<Map<String, dynamic>> remove(String? id,
[Map<String, dynamic>? params]) {
if (id == null || id == 'null') {
// Remove everything...
if (!(allowRemoveAll == true ||
params?.containsKey('provider') != true)) {
throw AngelHttpException.forbidden(
message: 'Clients are not allowed to delete all items.');
} else {
items.clear();
return Future.value({});
}
}
return read(id, params).then((result) {
if (items.remove(result)) {
return result;
} else {
throw AngelHttpException.notFound(
message: 'No record found for ID $id');
}
});
}