shouldUpdateLastMessage method

bool shouldUpdateLastMessage(
  1. BaseMessage message,
  2. Sender? sender
)

Implementation

bool shouldUpdateLastMessage(BaseMessage message, Sender? sender) {
  final lm = lastMessage;
  if (!message.isSilent ||
      sender?.isCurrentUser == true ||
      message.forceUpdateLastMessage) {
    if (lm == null) {
      return true;
    } else if (lm.createdAt < message.createdAt) {
      return true;
    } else if (lm.createdAt == message.createdAt &&
        lm.messageId == message.messageId &&
        lm.updatedAt < message.updatedAt) {
      return true;
    }
  }
  return false;
}