updateOrCreate method

  1. @override
Future<T> updateOrCreate({
  1. required DocumentId docId,
  2. required T value,
})
override

Updates data on the document if it exists. Data will be merged with any existing document data.

If no document exists, a new document will be created

The value returned is the value passed in, a read is not performed

Implementation

@override
Future<T> updateOrCreate({
  required DocumentId docId,
  required T value,
}) async {
  await ref.doc(docId.docId).set(value, SetOptions(merge: true));

  return value;
}