markRead method

Future<void> markRead()

Acknowledges the newest rendered message as read at the server.

The target is the newest non-pending row of ConvoKitConversationState.messages by (createdAt, id), resolved when the request is sent. Nothing is sent while another acknowledgement is in flight (one follow-up is queued), when that row is at or below the last acknowledged target, when nothing is rendered, or while setVisible reports the conversation hidden; a deferred acknowledgement is sent once the conversation becomes visible again. The returned future settles with this call's request, or at once when nothing needs sending; a follow-up queued behind an in-flight request drains in the background. Read state for the connected user is never fabricated locally; it arrives from the server like every other participant's.

Every request carries the privateStateVersion of the membership the room opened with (none against a 0.6 backend), so the server also clears the connected user's own "mark unread" marker unless it changed since. When the room opened with that marker set and nothing is rendered, the first call instead clears the marker once through clearConversationUnread(conversationId, ifVersion: captured), under the same visibility gating; a cleared: false answer is not an error.

Implementation

Future<void> markRead() async {
  final generation = _generation;
  if (!_isCurrent(generation)) return;
  await _acknowledgeRead(generation);
}