fetchHistoryMessages method
Future<EMCursorResult<EMMessage?> >
fetchHistoryMessages(
- String conversationId, {
- EMConversationType type = EMConversationType.Chat,
- int pageSize = 20,
- String startMsgId = '',
在会话conversationId
中提取历史消息,按type
筛选。
结果按每页pageSize
分页,从startMsgId
开始。
Implementation
Future<EMCursorResult<EMMessage?>> fetchHistoryMessages(
String conversationId, {
EMConversationType type = EMConversationType.Chat,
int pageSize = 20,
String startMsgId = '',
}) async {
Map req = Map();
req['con_id'] = conversationId;
req['type'] = EMConversation.typeToInt(type);
req['pageSize'] = pageSize;
req['startMsgId'] = startMsgId;
Map result =
await _channel.invokeMethod(EMSDKMethod.fetchHistoryMessages, req);
EMError.hasErrorFromResult(result);
return EMCursorResult<EMMessage?>.fromJson(
result[EMSDKMethod.fetchHistoryMessages], dataItemCallback: (value) {
return EMMessage.fromJson(value);
});
}