setDoc method

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

create or update a document with id, merge defines whether the document should overwrite

Implementation

Future<void> setDoc(String id, var data, {bool merge = false}) {
  try {
    CollectionReference colRef = _collectionReference;
    return colRef.doc(id).set(data, SetOptions(merge: merge));
  } catch (e) {
    throw Exception(
        'cannot call set on Query, use collection reference instead');
  }
}