readDocument method
FutureOr<CRDTDocument>
readDocument(
- String documentId, {
- PeerId? peerId,
- void onDocument(
- CRDTDocument document
The document documentId holds, built and handed over, not followed.
CRDTDocumentStorageReading.readDocument on the storage of documentId,
which is where the whole of what it does is written down.
for (final id in await backend.documentIds) {
final note = await backend.readDocument(id);
// ...show it in a list
}
Implementation
FutureOr<CRDTDocument> readDocument(
String documentId, {
PeerId? peerId,
void Function(CRDTDocument document)? onDocument,
}) {
return storageForDocument(documentId).chain(
(storage) => storage.readDocument(peerId: peerId, onDocument: onDocument),
);
}