fetchPinnedMessages method
- required String conversationId,
~english
Fetches pinned messages.
Param conversationId
The conversation ID.
Returns The list of pinned messages.
Throws A description of the exception. See ChatError.
~end
~chinese
获取置顶消息。
Param conversationId
会话 ID。
Returns 置顶消息列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。
~end
Implementation
Future<List<ChatMessage>> fetchPinnedMessages(
{required String conversationId}) async {
Map map = {'convId': conversationId};
Map result = await ChatChannel.invokeMethod(
ChatMethodKeys.fetchPinnedMessages,
map,
);
try {
ChatError.hasErrorFromResult(result);
List<ChatMessage> messages = [];
List list = result[ChatMethodKeys.fetchPinnedMessages];
list.forEach((element) {
messages.add(ChatMessage.fromJson(element));
});
return messages;
} on ChatError catch (e) {
throw e;
}
}