loadPinnedMessages method

Future<List<EMMessage>> loadPinnedMessages()

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

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

Implementation

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