setDoc method
create or update a document with id
, merge
defines whether the document should overwrite
Implementation
Future<void> setDoc(String id, Object? data, {bool merge = false}) {
try {
CollectionReference colRef = _collectionReference as CollectionReference;
return colRef.doc(id).set(data, SetOptions(merge: merge));
} catch (e) {
throw Exception(
'cannot call set on Query, use collection reference instead');
}
}