addMessage method

  1. @override
void addMessage(
  1. MessageModel message
)
override

Implementation

@override
void addMessage(MessageModel message) {
  if (messageStreamController.isClosed) return;
  inflateMessage(message);
  //list反转后列是从底部向上展示,所以新来的消息需要插入到数据第0个位置
  initialMessageList.insert(0, message);
  messageStreamController.sink.add(initialMessageList);
  scrollToLastMessage();
}