saveRoomMembers method
- String roomId,
- ChatPaginatedResponse<
RoomUser> members
Room member roster, as returned by an UNPAGINATED, UNEXPANDED
members.list — the only shape MembersApi caches, so one record
per room can never be served to a caller that asked for a different
one. hasMore and totalCount travel with the items because a hit
that invented them would break the paginator of a large group.
getRoomMembers distinguishes the two "no items" cases the way
getRoom / getRoomDetail do: ChatSuccess(null) means "nothing
stored for this room" and ChatFailureResult means "the store could
not be read". Collapsing them would let a cacheOnly read answer
"this room has no members" off a box that failed to open.
Default implementations are no-ops so non-persistent datasources keep working, at the cost of a roster that does not survive a restart.
Implementation
@override
Future<ChatResult<void>> saveRoomMembers(
String roomId,
ChatPaginatedResponse<RoomUser> members,
) async {
_roomMembers[roomId] = members;
return const ChatSuccess(null);
}