updateLocalDoc method

  1. @protected
DTO updateLocalDoc({
  1. required String id,
  2. required UpdateDocDef<DTO, MODEL> doc,
  3. bool doNotifyListeners = true,
})

Updates an existing document in local state.

Parameters:

  • id - The document ID
  • doc - The document update function
  • doNotifyListeners - 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;
}