delete method

WriteBatch delete(
  1. DocumentReference<Object?> documentRef
)

Adds a delete of the document documentRef.

Deleting a document that does not exist is not an error. The subcollections of the document are not deleted.

batch.delete(firestore.doc('cities/SF'));

Throws an ArgumentError if documentRef belongs to another FirebaseFirestore instance and a StateError if the batch was already committed.

Returns this batch, so that calls can be chained.

Implementation

WriteBatch delete(DocumentReference<Object?> documentRef) {
  _firestore.validateReference(documentRef);
  _verifyNotCommitted();
  _mutations.add(DeleteMutation(documentRef.key, Precondition.none));
  return this;
}