MessagesViewController constructor

MessagesViewController({
  1. required ChatUIKitProfile profile,
  2. int pageSize = 30,
  3. Message? searchedMsg,
  4. Future<Message>? willSendHandler(
    1. Message willSendMessage
    )?,
})

Implementation

MessagesViewController({
  required this.profile,
  this.pageSize = 30,
  this.searchedMsg,
  this.willSendHandler,
}) {
  ChatUIKit.instance.addObserver(this);
  conversationType = () {
    if (profile.type == ChatUIKitProfileType.group) {
      return ConversationType.GroupChat;
    } else {
      return ConversationType.Chat;
    }
  }();
  userMap[profile.id] = profile;
  if (ChatUIKitProvider.instance.currentUserProfile != null) {
    // 这能保证每次修改自己的信息后看到的历史信息数据是正确的
    userMap[ChatUIKit.instance.currentUserId!] =
        ChatUIKitProvider.instance.currentUserProfile!;
  }
}