hideMessageLocally method

  1. @override
Future<ChatResult<void>> hideMessageLocally(
  1. String roomId,
  2. String messageId
)
override

"Delete for me" persistence: a per-room set of message IDs the user explicitly hid via messages.deleteLocally. The network list endpoint has no concept of per-user hiding, so without this set the tombstone (or the deleted message) re-appears every time the chat is re-opened. Default implementations are no-ops so non-persistent datasources (memory) keep working, at the cost of losing the hidden set on app restart.

Implementation

@override
Future<ChatResult<void>> hideMessageLocally(
  String roomId,
  String messageId,
) async {
  (_hiddenMessages[roomId] ??= <String>{}).add(messageId);
  return const ChatSuccess(null);
}