delete method

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

Deletes the document documentRef when the transaction commits.

Deleting a missing document is not an error. If the transaction read documentRef before, the commit checks that it has not changed since.

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

Throws an ArgumentError if documentRef belongs to another FirebaseFirestore instance, and a FirestoreException with FirestoreErrorCode.invalidArgument in a read-only transaction.

Returns this transaction, so that calls can be chained.

Implementation

Transaction delete(DocumentReference<Object?> documentRef) {
  _firestore.validateReference(documentRef);
  _transaction.delete(documentRef.key);
  return this;
}