Simply watchers logic

This commit is contained in:
Leandro Borges Ferreira
2023-01-30 17:59:39 +01:00
parent 46f09e7067
commit 1b9110a034
@@ -2115,16 +2115,9 @@ class ChannelClientState {
.toList();
/// Channel watchers list as a stream.
Stream<List<User>> get watchersStream => CombineLatestStream.combine2<
List<User>?, Map<String?, User?>, List<User>>(
channelStateStream
.map((cs) => cs.watchers)
.where((watchers) => watchers != null),
_channel.client.state.usersStream,
(watchers, users) {
return watchers!.map((e) => users[e.id] ?? e).toList();
} ,
);
Stream<List<User>?> get watchersStream => channelStateStream
.map((cs) => cs.watchers)
.where((watchers) => watchers != null);
/// Channel member for the current user.
Member? get currentUserMember => members.firstWhereOrNull(