updateLocalDoc method
DTO
updateLocalDoc({
- required String id,
- required UpdateDocDef<
DTO, MODEL> doc, - bool doNotifyListeners = true,
Updates an existing document in local state.
Parameters:
id- The document IDdoc- The document update functiondoNotifyListeners- Whether to notify listeners of the change
Implementation
@protected
DTO updateLocalDoc({
required String id,
required UpdateDocDef<DTO, MODEL> doc,
bool doNotifyListeners = true,
}) {
final pDoc = doc(_doc.value, vars(id: id));
log.debug('Updating local doc with id: ${pDoc.id}');
if (doNotifyListeners) {
beforeLocalNotifyUpdate?.call(pDoc);
}
_doc.update(
modelBuilder(this, null, pDoc),
doNotifyListeners: doNotifyListeners,
);
if (doNotifyListeners) {
afterLocalNotifyUpdate?.call(pDoc);
}
return pDoc;
}