createLocalDoc method
Creates a new document in local state.
Parameters:
doc
- The document to createdoNotifyListeners
- Whether to notify listeners of the change
Implementation
@protected
T createLocalDoc({
required CreateDocDef<T> doc,
bool doNotifyListeners = true,
}) {
final pDoc = doc(turboVars());
log.debug('Creating local doc with id: ${pDoc.id}');
if (doNotifyListeners) {
beforeLocalNotifyUpdate?.call(pDoc);
}
_doc.update(pDoc, doNotifyListeners: doNotifyListeners);
if (doNotifyListeners) {
afterLocalNotifyUpdate?.call(pDoc);
}
return pDoc;
}