delete method

void delete(
  1. DocumentReference<Object?> documentRef, {
  2. Precondition? precondition,
})

Deletes a document from the database.

  • precondition can be passed to specify custom requirements for the request (e.g. only delete if it was last updated at a given time).

Implementation

void delete(
  DocumentReference<Object?> documentRef, {
  Precondition? precondition,
}) {
  _verifyNotCommited();

  firestore1.Write op() {
    final write = firestore1.Write(
      delete: documentRef._formattedName,
    );
    if (precondition != null && !precondition._isEmpty) {
      write.currentDocument = precondition._toProto();
    }
    return write;
  }

  _operations.add((docPath: documentRef.path, op: op));
}