fromConversation static method

Future<ConversationItemModel> fromConversation(
  1. Conversation conversation,
  2. ChatUIKitProfile profile
)

Implementation

static Future<ConversationItemModel> fromConversation(
  Conversation conversation,
  ChatUIKitProfile profile,
) async {
  int unreadCount = await conversation.unreadCount();
  Message? lastMessage = await conversation.latestMessage();

  bool noDisturb =
      ChatUIKitContext.instance.conversationIsMute(conversation.id);

  ConversationItemModel info = ConversationItemModel(
    profile: profile,
    unreadCount: unreadCount,
    lastMessage: lastMessage,
    pinned: conversation.isPinned,
    noDisturb: noDisturb,
    hasMention: conversation.ext?[hasMentionKey] == hasMentionValue,
    attributes: conversation.ext,
  );
  return info;
}