apply method
Implementation
Set<ChatMessage> apply(Object ownerToken) {
if (_applied) throw StateError('Mutation already applied');
for (final entry in _revisions.entries) {
entry.key.projectionRequireOwner(ownerToken);
if (entry.key.revision != entry.value) {
throw StateError('Stale content mutation');
}
}
_applied = true;
final changed = <ChatMessage>{};
for (final part in parts) {
final before = part.target.revision;
part.target.projectionAppendAcceptedTextForOwner(
ownerToken,
part.text,
acceptedUtf8Bytes: part.acceptedUtf8Bytes,
);
if (before != part.target.revision) changed.add(part.target);
}
final target = omissionTarget;
final omitted = omission;
if (target != null &&
omitted != null &&
target.projectionAddOmissionForOwner(ownerToken, omitted)) {
changed.add(target);
}
return changed;
}