delete method
Future<void>
delete(
- String id, {
- Map<
String, dynamic> body = const {}, - Map<
String, dynamic> query = const {}, - Map<
String, String> headers = const {},
override
Deletes a single record model by its id.
If the current AuthStore.record matches with the deleted id, then on success the client AuthStore will be also cleared.
Implementation
@override
Future<void> delete(
String id, {
Map<String, dynamic> body = const {},
Map<String, dynamic> query = const {},
Map<String, String> headers = const {},
}) {
return super
.delete(
id,
body: body,
query: query,
headers: headers,
)
.then((_) {
if (client.authStore.record != null &&
(client.authStore.record as RecordModel).id == id &&
[
(client.authStore.record as RecordModel).collectionId,
(client.authStore.record as RecordModel).collectionName,
].contains(_collectionIdOrName)) {
client.authStore.clear();
}
return;
});
}