onMessagesReceived method

  1. @override
void onMessagesReceived(
  1. List<Message> messages
)
override

Implementation

@override
void onMessagesReceived(List<Message> messages) async {
  bool needUpdate = false;
  if (loadFinished) {
    for (var msg in messages) {
      if (msg.isChatThreadMessage && msg.conversationId == thread!.threadId) {
        needUpdate = true;
        List<MessageReaction>? list = await msg.reactionList();
        msgModelList.add(MessageModel(message: msg, reactions: list));
        ChatUIKitProfile? profile =
            ChatUIKitProvider.instance.getProfileById(msg.from!);
        profile ??= msg.fromProfile;
        userMap[msg.from!] = profile;
      }
    }
  }
  if (needUpdate) {
    refresh();
  }
}