getReadStatus method
Returns Map
with key as userId String and value as Map
that conatins
two keys: user
and last_seen_at
. If includeAll
is provided as
true
then current user will be included as well.
{
'userId1': {
'user': User(),
'last_seen_at': 1682131232
}
}
Implementation
Map<String, Map<String, dynamic>> getReadStatus(bool includeAll) {
if (isSuper) return {};
// if (_sdk.state.currentUser == null) return []; //check connection
return Map.fromIterable(
members.where((m) {
if (!includeAll && m.isCurrentUser) return false;
return true;
}),
key: (m) => m.userId,
value: (m) {
final readStatus = _sdk.cache.find<ReadStatus>(
channelKey: channelUrl,
key: m.userId,
);
return {'user': m, 'last_seen_at': readStatus?.timestamp};
},
);
}