delete method
Method to delete the document.
Example:
documentRef.delete();
Implementation
Future<bool> delete() {
return _db
._w(
reference: reference,
collectionPath: _p.path,
collectionId: _p.id,
documentId: id,
type: InAppWriteType.document,
)
.then<bool>((_) {
if (_) {
return _p.get().then((value) {
if (!value.exists) {
return _db._w(
type: InAppWriteType.collection,
reference: _p.reference,
collectionPath: _p.path,
collectionId: _p.id,
documentId: _p.id,
);
} else {
return true;
}
});
} else {
return _;
}
}).then(_n);
}