V2TIMMessageManager class Manager

提供高级消息处理相关接口

addAdvancedMsgListener 添加高级消息的事件监听器

removeAdvancedMsgListener 移除高级消息监听器

sendCustomMessage 创建自定义消息

sendImageMessage 创建图片消息(图片最大支持 28 MB)

sendSoundMessage 创建语音消息(语音最大支持 28 MB)

createVideoMessage 创建视频消息(视频最大支持 100 MB)

sendVideoMessage 创建文件消息(文件最大支持 100 MB)

getC2CHistoryMessageList 获取单聊历史消息

getGroupHistoryMessageList 获取群组历史消息

getHistoryMessageList 获取历史消息高级接口

revokeMessage 撤回消息

markC2CMessageAsRead 设置单聊消息已读

markGroupMessageAsRead 设置群组消息已读

deleteMessageFromLocalStorage 删除本地消息

deleteMessages 删除本地及漫游消息

Constructors

V2TIMMessageManager()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAdvancedMsgListener({required V2TimAdvancedMsgListener listener}) Future<void>
添加高级消息的事件监听器
addMessageReaction({required String msgID, required String reactionID}) Future<V2TimCallback>
appendMessage({required String createMessageBaseId, required String createMessageAppendId}) Future<V2TimValueCallback<V2TimMessage>>
添加多Element消息
clearC2CHistoryMessage({required String userID}) Future<V2TimCallback>
清空单聊本地及云端的消息(不删除会话)
clearGroupHistoryMessage({required String groupID}) Future<V2TimCallback>
清空群聊本地及云端的消息(不删除会话)
convertVoiceToText({required String msgID, required String language}) Future<V2TimValueCallback<String>>
createAtSignedGroupMessage({required String createdMsgID, required List<String> atUserList}) Future<V2TimValueCallback<V2TimMessage>>
createCustomMessage({required String data, String desc = "", String extension = ""}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建定制化消息
createFaceMessage({required int index, required String data}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建表情消息 index 表情索引 data 自定义数据 备注:
createFileMessage({required String filePath, required String fileName, dynamic inputElement}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建文件消息
createForwardMessage({required String msgID, String? webMessageInstance}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
createImageMessage({required String imagePath, dynamic inputElement, String? imageName}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建图片消息(图片文件最大支持 28 MB)
createLocationMessage({required String desc, required double longitude, required double latitude}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建位置信息 longitude 经度,发送消息时设置 latitude 纬度,发送消息时设置 desc 地理位置描述信息
createMergerMessage({required List<String> msgIDList, required String title, required List<String> abstractList, required String compatibleText}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建合并消息 参数:
createSoundMessage({required String soundPath, required int duration}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建音频文件 soundPath 音频文件地址 duration 时长
createTargetedGroupMessage({required String id, required List<String> receiverList}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
如果您需要在群内给指定群成员列表发消息,可以创建一条定向群消息,定向群消息只有指定群成员才能收到。
createTextAtMessage({required String text, required List<String> atUserList}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建文本消息,并且可以附带 @ 提醒功能(最大支持 8KB) 提醒消息仅适用于在群组中发送的消息
createTextMessage({required String text}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建文本消息
createVideoMessage({required String videoFilePath, required String type, required int duration, required String snapshotPath, dynamic inputElement}) Future<V2TimValueCallback<V2TimMsgCreateInfoResult>>
创建视频文件 videoFilePath 路径 type 视频类型,如 mp4 mov 等 duration 视频时长,单位 s snapshotPath 视频封面图片路径 inputElement 用于选择视频文件的 DOM 节点 (只有web端用到且必填)
deleteMessageExtensions({required String msgID, required List<String> keys}) Future<V2TimValueCallback<List<V2TimMessageExtensionResult>>>
deleteMessageFromLocalStorage({required String msgID}) Future<V2TimCallback>
删除本地消息
deleteMessages({required List<String> msgIDs, List? webMessageInstanceList}) Future<V2TimCallback>
删除本地及漫游消息
downloadMergerMessage({required String msgID, String? webMessageInstance}) Future<V2TimValueCallback<List<V2TimMessage>>>
获取合并消息的子消息列表(下载被合并的消息列表) 参数: msgID 合并消息的msgID
downloadMessage({required String msgID, required int messageType, required int imageType, required bool isSnapshot}) Future<V2TimCallback>
下载多媒体消息
findMessages({required List<String> messageIDList}) Future<V2TimValueCallback<List<V2TimMessage>>>
根据 messageID 查询指定会话中的本地消息 参数:messageIDList 消息ID列表
getAllReceiveMessageOpt() Future<V2TimValueCallback<V2TimReceiveMessageOptInfo>>
getAllUserListOfMessageReaction({required String msgID, required String reactionID, required int nextSeq, required int count, String? webMessageInstance}) Future<V2TimValueCallback<V2TimMessageReactionUserResult>>
getC2CHistoryMessageList({required String userID, required int count, String? lastMsgID}) Future<V2TimValueCallback<List<V2TimMessage>>>
获取单聊历史消息
getC2CReceiveMessageOpt({required List<String> userIDList}) Future<V2TimValueCallback<List<V2TimReceiveMessageOptInfo>>>
查询针对某个用户的 C2C 消息接收选项
getGroupHistoryMessageList({required String groupID, required int count, String? lastMsgID}) Future<V2TimValueCallback<List<V2TimMessage>>>
获取群组历史消息
getGroupMessageReadMemberList({required String messageID, required GetGroupMessageReadMemberListFilter filter, int nextSeq = 0, int count = 100}) Future<V2TimValueCallback<V2TimGroupMessageReadMemberList>>
获取群消息已读群成员列表 3.9.3及以上版本支持
getHistoryMessageList({HistoryMsgGetTypeEnum? getType = HistoryMsgGetTypeEnum.V2TIM_GET_LOCAL_OLDER_MSG, String? userID, String? groupID, int lastMsgSeq = -1, required int count, String? lastMsgID, List<int>? messageTypeList, List<int>? messageSeqList, int? timeBegin, int? timePeriod}) Future<V2TimValueCallback<List<V2TimMessage>>>
获取历史消息高级接口
getHistoryMessageListV2({HistoryMsgGetTypeEnum? getType = HistoryMsgGetTypeEnum.V2TIM_GET_LOCAL_OLDER_MSG, String? userID, String? groupID, int lastMsgSeq = -1, required int count, String? lastMsgID, List<int>? messageTypeList, List<int>? messageSeqList, int? timeBegin, int? timePeriod}) Future<V2TimValueCallback<V2TimMessageListResult>>
获取历史消息高级接口
getHistoryMessageListWithoutFormat({HistoryMsgGetTypeEnum? getType = HistoryMsgGetTypeEnum.V2TIM_GET_LOCAL_OLDER_MSG, String? userID, String? groupID, int lastMsgSeq = -1, required int count, String? lastMsgID, List<int>? messageSeqList, int? timeBegin, int? timePeriod}) Future<LinkedHashMap>
获取历史消息高级接口(没有处理Native返回数据)
getMessageExtensions({required String msgID}) Future<V2TimValueCallback<List<V2TimMessageExtension>>>
获取消息扩展(Flutter SDK 4.2.0及以上版本支持,需要您购买旗舰版套餐)
getMessageOnlineUrl({required String msgID}) Future<V2TimValueCallback<V2TimMessageOnlineUrl>>
获取多媒体消息URL
getMessageReactions({required List<String> msgIDList, required int maxUserCountPerReaction, List<String>? webMessageInstanceList}) Future<V2TimValueCallback<List<V2TimMessageReactionResult>>>
getMessageReadReceipts({required List<String> messageIDList}) Future<V2TimValueCallback<List<V2TimMessageReceipt>>>
获取消息已读回执 3.9.3及以上版本支持 该接口暂时只支持 Group 消息。 messageIDList 里的消息Id必须在同一个 Group 会话中。
getPinnedGroupMessageList({required String groupID}) Future<V2TimValueCallback<List<V2TimMessage>>>
insertC2CMessageToLocalStorage({required String data, required String userID, required String sender}) Future<V2TimValueCallback<V2TimMessage>>
向C2C消息列表中添加一条消息
insertC2CMessageToLocalStorageV2({required String userID, required String senderID, required String createdMsgID}) Future<V2TimValueCallback<V2TimMessage>>
insertGroupMessageToLocalStorage({required String data, required String groupID, required String sender}) Future<V2TimValueCallback<V2TimMessage>>
向群组消息列表中添加一条消息 该接口主要用于满足向群组聊天会话中插入一些提示性消息的需求,比如“您已经退出该群”,这类消息有展示 在聊天消息区的需求,但并没有发送给其他人的必要。 所以 insertGroupMessageToLocalStorage() 相当于一个被禁用了网络发送能力的 sendMessage() 接口。
insertGroupMessageToLocalStorageV2({required String groupID, required String senderID, required String createdMsgID}) Future<V2TimValueCallback<V2TimMessage>>
markAllMessageAsRead() Future<V2TimCallback>
标记所有消息为已读
markC2CMessageAsRead({required String userID}) Future<V2TimCallback>
设置单聊消息已读
markGroupMessageAsRead({required String groupID}) Future<V2TimCallback>
设置群组消息已读
modifyMessage({required V2TimMessage message, dynamic required}) Future<V2TimValueCallback<V2TimMessageChangeInfo>>
消息变更 4.0.1及以后版本支持 如果消息修改成功,自己和对端用户(C2C)或群组成员(Group)都会收到 onRecvMessageModified 回调。 如果在修改消息过程中,消息已经被其他人修改,completion 会返回 ERR_SDK_MSG_MODIFY_CONFLICT 错误。 消息无论修改成功或则失败,都会返回最新的消息对象。 目前支持修改项目 localCustomData localCustomInt cloudCustomData V2TIMTextElem V2TIMCustomElem
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pathExits(String fpath) Future<bool>
pinGroupMessage({required String msgID, required String groupID, required bool isPinned}) Future<V2TimCallback>
removeAdvancedMsgListener({V2TimAdvancedMsgListener? listener}) Future<void>
移除高级消息监听器
removeMessageReaction({required String msgID, required String reactionID}) Future<V2TimCallback>
reSendMessage({required String msgID, bool onlineUserOnly = false, Object? webMessageInstatnce}) Future<V2TimValueCallback<V2TimMessage>>
消息重发
revokeMessage({required String msgID, Object? webMessageInstatnce}) Future<V2TimCallback>
撤回消息
searchCloudMessages({required V2TimMessageSearchParam searchParam}) Future<V2TimValueCallback<V2TimMessageSearchResult>>
searchLocalMessages({required V2TimMessageSearchParam searchParam}) Future<V2TimValueCallback<V2TimMessageSearchResult>>
搜索本地消息 参数:searchParam消息搜索参数,详见 V2TimMessageSearchParam 的定义
sendCustomMessage({required String data, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, String desc = "", String extension = "", bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo}) Future<V2TimValueCallback<V2TimMessage>>
发送自定义消息
sendFaceMessage({required int index, required String data, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo}) Future<V2TimValueCallback<V2TimMessage>>
创建表情消息
sendFileMessage({required String filePath, required String fileName, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo, Uint8List? fileContent}) Future<V2TimValueCallback<V2TimMessage>>
发送文件 web 端 fileName、fileContent 为必传字段
sendForwardMessage({required String msgID, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo, String? webMessageInstance}) Future<V2TimValueCallback<V2TimMessage>>
转发消息
sendImageMessage({required String imagePath, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo, String? fileName, Uint8List? fileContent}) Future<V2TimValueCallback<V2TimMessage>>
发送图片消息
sendLocationMessage({required String desc, required double longitude, required double latitude, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo}) Future<V2TimValueCallback<V2TimMessage>>
发送地理位置消息
sendMergerMessage({required List<String> msgIDList, required String title, required List<String> abstractList, required String compatibleText, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo, List<String>? webMessageInstanceList}) Future<V2TimValueCallback<V2TimMessage>>
合并消息
sendMessage({required String id, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, bool isExcludedFromLastMessage = false, bool? isSupportMessageExtension = false, bool? isExcludedFromContentModeration = false, bool needReadReceipt = false, OfflinePushInfo? offlinePushInfo, String? cloudCustomData, String? localCustomData}) Future<V2TimValueCallback<V2TimMessage>>
发送消息 参数
sendMessageReadReceipts({required List<String> messageIDList}) Future<V2TimCallback>
发送消息已读回执 3.9.3及以上版本支持 该接口暂时只支持 Group 消息。 messageIDList 里的消息Id必须在同一个 Group 会话中。 该接口调用成功后,会话未读数不会变化,消息发送者会收到 onRecvMessageReadReceipts 回调,回调里面会携带消息的最新已读信息。 参数:messageIDList,消息ID列表 注意:web不支持该忌口
sendReplyMessage({required String id, required String receiver, required String groupID, required V2TimMessage replyMessage, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, bool needReadReceipt = false, OfflinePushInfo? offlinePushInfo, String? localCustomData}) Future<V2TimValueCallback<V2TimMessage>>
发送回复消息
sendSoundMessage({required String soundPath, required String receiver, required String groupID, required int duration, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo}) Future<V2TimValueCallback<V2TimMessage>>
发送语音消息
sendTextAtMessage({required String text, required List<String> atUserList, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo}) Future<V2TimValueCallback<V2TimMessage>>
创建文本消息,并且可以附带 @ 提醒功能
sendTextMessage({required String text, required String receiver, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo}) Future<V2TimValueCallback<V2TimMessage>>
发送高级文本消息
sendVideoMessage({required String videoFilePath, required String receiver, required String type, required String snapshotPath, required int duration, required String groupID, MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL, bool onlineUserOnly = false, bool isExcludedFromUnreadCount = false, OfflinePushInfo? offlinePushInfo, String? fileName, Uint8List? fileContent}) Future<V2TimValueCallback<V2TimMessage>>
发送视频消息
setAllReceiveMessageOpt({required int opt, required int startHour, required int startMinute, required int startSecond, required int duration}) Future<V2TimCallback>
setAllReceiveMessageOptWithTimestamp({required int opt, required int startTimeStamp, required int duration}) Future<V2TimCallback>
setAvChatRoomCanFindMessage({required List<String> avchatroomIDs, int eachGroupMessageNums = 20}) Future<V2TimValueCallback<List<String>>>
让avchatroom可以使用findMesasge,用于如downloadMesage,getMesasgeOnlineUrl等接口(5.0.10以后支持)
setC2CReceiveMessageOpt({required List<String> userIDList, required ReceiveMsgOptEnum opt}) Future<V2TimCallback>
设置用户消息接收选项
setCloudCustomData({required String data, required String msgID}) Future<V2TimCallback>
设置云端自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到)
setGroupReceiveMessageOpt({required String groupID, required ReceiveMsgOptEnum opt}) Future<V2TimCallback>
修改群消息接收选项
setLocalCustomData({required String msgID, required String localCustomData}) Future<V2TimCallback>
设置消息自定义数据(本地保存,不会发送到对端,程序卸载重装后失效) localCustomData 只是透传 注意: web不支持该接口
setLocalCustomInt({required String msgID, required int localCustomInt}) Future<V2TimCallback>
设置消息自定义数据,可以用来标记语音、视频消息是否已经播放(本地保存,不会发送到对端,程序卸载重装后失效)
setMessageExtensions({required String msgID, required List<V2TimMessageExtension> extensions}) Future<V2TimValueCallback<List<V2TimMessageExtensionResult>>>
设置消息扩展(Flutter SDK 4.2.0及以上版本支持,需要您购买旗舰版套餐)
toString() String
A string representation of this object.
inherited
translateText({required List<String> texts, required String targetLanguage, String? sourceLanguage}) Future<V2TimValueCallback<Map<String, String>>>
翻译(5.0.8以后支持)

Operators

operator ==(Object other) bool
The equality operator.
inherited