set method
Writes to the document referred to by the provided DocumentReference.
If the document does not exist yet, it will be created.
If you pass options
, the provided data can be merged into
the existing document.
The DocumentReference parameter is a reference to the document to be created. Value must not be null.
The data
parameter is a Map of the fields and values for the document.
Value must not be null.
The optional options
parameters is an object to configure the set
behavior. Pass {merge: true}
to only replace the values specified in
the data argument. Fields omitted will remain untouched. Value may be null.
Returns non-null WriteBatch instance. Used for chaining method calls.
Implementation
WriteBatch set(DocumentReference documentRef, Map<String, dynamic> data,
[firestore_interop.SetOptions? options]) {
final jsObjectSet = (options != null)
? jsObject.set(documentRef.jsObject, jsify(data), options)
: jsObject.set(documentRef.jsObject, jsify(data));
return WriteBatch.getInstance(jsObjectSet);
}