set<T> method
Write to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If the document already exists, its contents will be overwritten with the newly provided data.
documentRef
: A reference to the document to be set.data
The object to serialize as the document.
Implementation
void set<T>(DocumentReference<T> documentRef, T data) {
if (_writeBatch == null) {
throw Exception(readOnlyWriteErrorMsg);
}
_writeBatch.set<T>(documentRef, data);
}