set method
Writes to the document referred to by this 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 data
parameter is a Map of the fields and values for the
document. Value must not be null.
The optional options
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 Future that resolves once the data has been successfully written to the backend. (Note that it won't resolve while you're offline).
Implementation
Future<void> set(Map<String, dynamic> data,
[firestore_interop.SetOptions? options]) {
final jsObjectSet = (options != null)
? jsObject.set(jsify(data), options)
: jsObject.set(jsify(data));
return handleThenable(jsObjectSet);
}