setDoc method

Future<void> setDoc(
  1. String id,
  2. Object? data, {
  3. bool merge = false,
})
inherited

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');
  }
}