getHistoryMessage static method
获取历史消息
conversationType
会话类型,参见枚举 RCConversationType
targetId
会话 id
messageId
消息 id,每次进入聊天页面可以传 -1
count
需要获取的消息数
Implementation
static Future<List?> getHistoryMessage(int conversationType, String targetId, int messageId, int count) async {
Map map = {'conversationType': conversationType, 'targetId': targetId, "messageId": messageId, "count": count};
List? list = await _channel.invokeMethod(RCMethodKey.GetHistoryMessage, map);
if (list == null) {
return [];
}
List msgList = [];
for (String msgStr in list) {
Message? msg = MessageFactory.instance!.string2Message(msgStr);
msgList.add(msg);
}
return msgList;
}