loadPinnedMessages method

Future<List<ChatMessage>> loadPinnedMessages()

~english Get the pinned messages in the conversation

Throws A description of the exception. See ChatError. ~end

~chinese 获取会话内的置顶消息列表

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end

Implementation

Future<List<ChatMessage>> loadPinnedMessages() async {
  Map req = this._toJson();
  Map result = await _emConversationChannel.invokeMethod(
      ChatMethodKeys.pinnedMessages, req);
  try {
    ChatError.hasErrorFromResult(result);
    List<ChatMessage> msgList = [];
    result[ChatMethodKeys.pinnedMessages]?.forEach((element) {
      msgList.add(ChatMessage.fromJson(element));
    });
    return msgList;
  } on ChatError catch (e) {
    throw e;
  }
}