getUndeliveredMembers method
- BaseMessage message
Returns the list of members that haven't received the given message. This excludes the current logged-in User and the Sender of the message. It will always be zero if the passed on message is an AdminMessage, or if this channel is a super group channel.
Implementation
List<Member> getUndeliveredMembers(BaseMessage message) {
sbLog.i(StackTrace.current, 'messageId: ${message.messageId}');
if (message is AdminMessage) return [];
if (isSuper) return [];
final deliveryStatus =
chat.channelCache.find<DeliveryStatus>(channelKey: channelUrl);
if (deliveryStatus == null) return [];
return members.where((m) {
if (m.isCurrentUser) return false;
if (message.sender?.userId == m.userId) return false;
if (m.memberState != MemberState.joined) return false;
final deliveredAt = deliveryStatus.updatedDeliveryStatus[m.userId] ?? 0;
return deliveredAt < message.createdAt;
}).toList();
}