create<T> method

void create<T>(
  1. DocumentReference<T> documentRef,
  2. T documentData
)

Create the document referred to by the provided DocumentReference. The operation will fail the transaction if a document exists at the specified location.

documentData data The object data to serialize as the document.

Implementation

void create<T>(DocumentReference<T> documentRef, T documentData) {
  if (_writeBatch == null) {
    throw Exception(readOnlyWriteErrorMsg);
  }
  _writeBatch.create(documentRef, documentData);
}