applyChange method

  1. @override
Future<bool> applyChange(
  1. String documentId,
  2. Change change
)
override

Applies change to documentId and returns whether it was new.

CausallyNotReadyException propagates, as CRDTServerRegistry requires: the server needs it to tell a client it is out of sync. DocumentDisposedException propagates too — it says the document was let go under the caller, which is a bug in the caller and not a bad change. Any other failure gives false: one bad change must not take the session down.

Implementation

@override
Future<bool> applyChange(String documentId, Change change) async {
  final document = await requireDocument(documentId);

  try {
    return document.applyChange(change);
  } on CausallyNotReadyException {
    rethrow;
  } on DocumentDisposedException {
    rethrow;
  } catch (_) {
    return false;
  }
}