fetchPinnedMessages method
- required String conversationId,
~english Gets the list of pinned messages from the server.
Param conversationId The conversation ID.
Returns The list of pinned messages.
Throws A description of the exception. See EMError.
~end
~chinese
从服务端获取置顶消息。
Param conversationId 会话 ID。
Returns 置顶消息列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。
~end
Implementation
Future<List<EMMessage>> fetchPinnedMessages(
{required String conversationId}) async {
try {
Map map = {'convId': conversationId};
Map result = await Client.instance.chatManager.callNativeMethod(
ChatMethodKeys.fetchPinnedMessages,
map,
);
EMError.hasErrorFromResult(result);
List<EMMessage> messages = [];
List list = result[ChatMethodKeys.fetchPinnedMessages];
for (var element in list) {
messages.add(EMMessage.fromJson(element));
}
return messages;
} catch (e) {
rethrow;
}
}