RongIMClient class
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
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited
Static Properties
-
chatRoomKVDidRemove
↔ dynamic Function(String? roomId, Map? entry)?
-
聊天室 KV 被删除的回调
getter/setter pair
-
chatRoomKVDidSync
↔ dynamic Function(String? roomId)?
-
刚加入聊天室时 KV 同步完成的回调
getter/setter pair
-
chatRoomKVDidUpdate
↔ dynamic Function(String? roomId, Map? entry)?
-
聊天室 KV 变化的回调
getter/setter pair
-
messageDecoders
↔ Map<String, MessageDecoder>
-
getter/setter pair
-
messageExpansionDidRemove
↔ dynamic Function(List? keyArray, Message? message)?
-
消息扩展信息删除的回调
getter/setter pair
-
messageExpansionDidUpdate
↔ dynamic Function(Map? expansionDic, Message? message)?
-
消息扩展信息更改的回调
getter/setter pair
-
onChatRoomDestroyed
↔ dynamic Function(String? targetId, int? type)?
-
聊天室被销毁的回调,用户在线的时候房间被销毁才会收到此回调。
getter/setter pair
-
onChatRoomReset
↔ dynamic Function(String? targetId)?
-
加入聊天室成功,但是聊天室被重置。接收到此回调后,还会收到 onChatRoomJoined 回调。
getter/setter pair
-
onConnectionStatusChange
↔ dynamic Function(int? connectionStatus)?
-
连接状态发生变更
getter/setter pair
-
onConversationTagChanged
↔ dynamic Function()?
-
设置 Tag 多端同步监听
getter/setter pair
-
onDatabaseOpened
↔ dynamic Function(int? status)?
-
getter/setter pair
-
onDataReceived
↔ dynamic Function(Map? data)?
-
收到原生数据的回调
getter/setter pair
-
onDownloadMediaMessageResponse
↔ dynamic Function(int? code, int? progress, int? messageId, Message? message)?
-
getter/setter pair
-
onJoinChatRoom
↔ dynamic Function(String? targetId, int? status)?
-
加入聊天的回调
getter/setter pair
-
onJoiningChatRoom
↔ dynamic Function(String? targetId)?
-
开始加入聊天室的回调
getter/setter pair
-
onMessageBlocked
↔ dynamic Function(BlockedMessageInfo info)?
-
发送含有敏感词消息被拦截的回调
getter/setter pair
-
onMessageDestructing
↔ dynamic Function(Message? msg, int? remainDuration)?
-
getter/setter pair
-
onMessageReceiptRequest
↔ dynamic Function(Map? data)?
-
请求消息已读回执
getter/setter pair
-
onMessageReceiptResponse
↔ dynamic Function(Map? data)?
-
消息已读回执响应(收到阅读回执响应,可以按照 messageUId 更新消息的阅读数)
getter/setter pair
-
onMessageReceived
↔ dynamic Function(Message? msg, int? left)?
-
收到消息的回调,功能和 onMessageReceivedWrapper 一样,两个回调只能实现一个,否则会出现重复收到消息的情况
getter/setter pair
-
onMessageReceivedWrapper
↔ dynamic Function(Message? msg, int? left, bool? hasPackage, bool? offline)?
-
收到消息的回调,功能和 onMessageReceived 一样,两个回调只能实现一个,否则会出现重复收到消息的情况
getter/setter pair
-
onMessageSend
↔ dynamic Function(int? messageId, int? status, int? code)?
-
调用发送消息接口 sendMessage 结果的回调
getter/setter pair
-
onQuitChatRoom
↔ dynamic Function(String? targetId, int? status)?
-
退出聊天的回调
getter/setter pair
-
onRecallMessageReceived
↔ dynamic Function(Message? msg)?
-
getter/setter pair
-
onReceiveReadReceipt
↔ dynamic Function(Map? data)?
-
收到已读消息回执
getter/setter pair
-
onTagChanged
↔ dynamic Function()?
-
标签变化监听器
getter/setter pair
-
onTypingStatusChanged
↔ dynamic Function(int? conversationType, String? targetId, List typingStatus)?
-
getter/setter pair
-
onUploadMediaProgress
↔ dynamic Function(int? messageId, int? progress)?
-
发送媒体消息(图片/语音消息)的媒体上传进度
getter/setter pair
-
sdkVersion
→ String
-
final
-
sendMessageCallbacks
↔ Map
-
getter/setter pair
Static Methods
-
addConversationsToTag(String? tagId, List? identifiers, dynamic finished(bool? result, int? code)?)
→ Future
-
添加会话到一个标签
tagId
标签 id
identifiers
会话列表
-
addMessageDecoder(String objectName, MessageDecoder messageDecoder)
→ void
-
注册Flutter端自定义消息
objectName
希望注册的新消息类型,例如:RC:TxtMsg。
messageDecoder
消息加息函数
在 init 之后,connect 之前进行注册
-
addTag(TagInfo? taginfo, dynamic finished(int? code)?)
→ Future<void>
-
-
addToBlackList(String userId, dynamic finished(int? code)?)
→ Future<void>
-
将用户加入黑名单,黑名单针对用户 id 生效,即使换设备也依然生效。
-
batchInsertMessage(List<Message> msgs, dynamic finished(bool? result, int? code)?)
→ Future<void>
-
-
cancelDownloadMediaMessage(int messageId)
→ Future<bool?>
-
取消下载中的媒体文件
-
cancelSendMediaMessage(Message message, dynamic finished(int? code)?)
→ Future<void>
-
取消发送媒体消息
-
clearConversations(List<int> conversationTypes, dynamic finished(int? code)?)
→ Future<void>
-
清空会话类型列表中的所有会话及会话信息
-
clearHistoryMessages(int? conversationType, String? targetId, int recordTime, bool clearRemote, dynamic finished(int? code)?)
→ Future<void>
-
清除历史消息
-
clearMessages(int? conversationType, String? targetId, dynamic finished(int? code)?)
→ Future<void>
-
清空指定类型,targetId 的某一会话所有聊天消息记录
-
clearMessagesUnreadStatus(int conversationType, String targetId)
→ Future<bool?>
-
清除会话的未读消息
-
config(Map conf)
→ Future<void>
-
配置 SDK
-
connect(String token, dynamic finished(int? code, String? userId)?)
→ Future<void>
-
连接 SDK
-
deleteMessageByIds(List<int> messageIds, dynamic finished(int? code)?)
→ Future<void>
-
批量删除消息
-
deleteMessages(int conversationType, String targetId, dynamic finished(int? code)?)
→ Future<void>
-
删除特定会话的消息
-
deleteRemoteMessages(int? conversationType, String? targetId, List<Message> messages, dynamic finished(int? code)?)
→ Future<void>
-
删除指定的一条或者一组消息。会同时删除本地和远端消息
会话类型, 不支持聊天室
-
disconnect(bool needPush)
→ Future<void>
-
断开连接
-
downloadMediaMessage(Message message)
→ Future<void>
-
下载媒体文件
-
forceRemoveChatRoomEntry(String chatRoomId, String key, bool sendNotification, dynamic finished(int? code)?)
→ Future<void>
-
强制删除聊天室自定义属性
-
forceSetChatRoomEntry(String chatRoomId, String key, String value, bool sendNotification, bool autoDelete, dynamic finished(int? code)?)
→ Future<void>
-
强制设置聊天室自定义属性
-
forwardMessageByStep(int conversationType, String targetId, Message message, {dynamic finished(int messageId, int status, int code)?})
→ Future<void>
-
-
getAllChatRoomEntries(String chatRoomId, dynamic finished(Map? entry, int? code)?)
→ Future<void>
-
获取聊天室所有自定义属性
-
getBlackList(dynamic finished(List? userIdList, int? code)?)
→ Future<void>
-
查询已经设置的黑名单列表
-
getBlackListStatus(String userId, dynamic finished(int? blackListStatus, int? code)?)
→ Future<void>
-
获取特定用户的黑名单状态
-
getBlockedConversationList(List<int> conversationTypeList, dynamic finished(List? convertionList, int? code)?)
→ Future<void>
-
获取设置免打扰的会话列表
-
getChatRoomEntry(String chatRoomId, String key, dynamic finished(Map? entry, int? code)?)
→ Future<void>
-
获取聊天室单个属性
-
getChatRoomInfo(String targetId, int memeberCount, int memberOrder)
→ Future
-
获取聊天室信息
-
getConnectionStatus()
→ Future<int?>
-
获取当前 SDK 的连接状态
-
getConversation(int? conversationType, String? targetId)
→ Future<Conversation?>
-
获取特定会话的详细信息
-
getConversationList(List<int> conversationTypeList)
→ Future<List?>
-
根据传入的会话类型来获取会话列表
-
getConversationListByPage(List<int> conversationTypeList, int count, int startTime)
→ Future<List?>
-
根据传入的会话类型来分页获取会话列表
-
getConversationNotificationStatus(int conversationType, String targetId, dynamic finished(int? status, int? code)?)
→ Future<void>
-
获取会话的提醒状态
-
getConversationsFromTagByPage(String? tagId, int ts, int count, dynamic finished(int? code, List conversationList)?)
→ Future
-
分页获取本地指定标签下会话列表
tagId
标签 id
ts
会话中最后一条消息时间戳
count
获取数量(20<= count <=100)
-
getConversationTopStatusInTag(int? conversationType, String? targetId, String? tagId, dynamic finished(bool? result, int? code)?)
→ Future
-
获取指定会话下的标签置顶状态
conversationType
会话类型
targetId
会话 id
tagId
标签 id
-
getDeltaTime()
→ Future<int?>
-
获取本地时间与服务器时间的差值。 消息发送成功后,sdk 会与服务器同步时间,消息所在数据库中存储的时间就是服务器时间。
-
getFirstUnreadMessage(int conversationType, String targetId)
→ Future<Message?>
-
获取会话里第一条未读消息。
-
getHistoryMessage(int conversationType, String targetId, int messageId, int count)
→ Future<List?>
-
获取历史消息
-
getHistoryMessages(int? conversationType, String? targetId, int sentTime, int beforeCount, int afterCount)
→ Future<List?>
-
获取特定方向的历史消息
-
getMessage(int messageId)
→ Future<Message?>
-
获取本地单条消息
-
getMessageByUId(String messageUId)
→ Future<Message?>
-
通过全局唯一 ID 获取消息实体
发送 message 成功后,服务器会给每个 message 分配一个唯一 ID(messageUId)
-
getMessages(int conversationType, String targetId, HistoryMessageOption option, dynamic finished(List? msgList, int? code)?)
→ Future<void>
-
-
getNotificationQuietHours(dynamic finished(int? code, String? startTime, int? spansMin)?)
→ Future<void>
-
查询已设置的全局时间段消息提醒屏蔽
-
getOfflineMessageDuration()
→ Future<int?>
-
获取当前用户离线消息的存储时间,取值范围为int值1~7天
-
getRemoteChatRoomHistoryMessages(String targetId, int recordTime, int count, int order, dynamic finished(List? msgList, int? syncTime, int? code)?)
→ Future<void>
-
-
getRemoteHistoryMessages(int conversationType, String targetId, int recordTime, int count, dynamic finished(List? msgList, int? code)?)
→ Future<void>
-
返回一个Map {"code":...,"messages":...,"isRemaining":...}
code:是否获取成功
messages:获取到的历史消息数组,
isRemaining:是否还有剩余消息 YES 表示还有剩余,NO 表示无剩余
-
getTags(dynamic finished(int? code, List tags)?)
→ Future
-
-
getTagsFromConversation(int? conversationType, String? targetId, dynamic finished(int? code, List conversationList)?)
→ Future
-
获取指定会话下的所有标签
conversationType
会话类型
targetId
会话 id
-
getTextMessageDraft(int? conversationType, String? targetId)
→ Future<String?>
-
根据消息类型,targetId 获取某一会话的文字消息草稿。用于获取用户输入但未发送的暂存消息。
-
getTotalUnreadCount(dynamic finished(int? count, int? code)?)
→ Future<void>
-
获取所有的未读数
-
getUnreadCount(int conversationType, String targetId, dynamic finished(int? count, int? code)?)
→ Future<void>
-
获取单个会话的未读数
-
getUnreadCountByTag(String? tagId, bool containBlocked, dynamic finished(int? result, int? code)?)
→ Future
-
按标签获取未读消息数
tagId
标签 id
containBlocked
是否包含免打扰
result 大于等于 0 表示返回成功结果数量,等于 -1 表示获取错误,错误码为 code 的值
-
getUnreadCountConversationTypeList(List<int> conversationTypeList, bool isContain, dynamic finished(int? count, int? code)?)
→ Future<void>
-
批量获取特定某些会话的未读数
-
getUnreadMentionedMessages(int conversationType, String targetId)
→ Future<List>
-
获取会话中@提醒自己的消息
-
imageCompressConfig(double maxSize, double minSize, double quality)
→ Future<void>
-
-
init(String appkey)
→ Future<void>
-
初始化 SDK
-
insertIncomingMessage(int conversationType, String targetId, String senderUserId, int receivedStatus, MessageContent content, int sendTime, dynamic finished(Message? msg, int? code)?)
→ Future<void>
-
插入一条收到的消息
-
insertOutgoingMessage(int conversationType, String targetId, int sendStatus, MessageContent content, int sendTime, dynamic finished(Message? msg, int? code)?)
→ Future<void>
-
插入一条发出的消息
-
joinChatRoom(String targetId, int messageCount)
→ Future<void>
-
加入聊天室
-
joinExistChatRoom(String? targetId, int? messageCount)
→ Future<void>
-
加入已存在的聊天室
-
messageBeginDestruct(Message message)
→ Future<void>
-
开始焚烧消息
-
messageStopDestruct(Message message)
→ Future<void>
-
停止焚烧消息(目前仅支持单聊)
-
quitChatRoom(String targetId)
→ Future<void>
-
退出聊天室
-
recallMessage(Message? message, String? pushContent)
→ Future<RecallNotificationMessage?>
-
撤回消息
-
removeChatRoomEntries(String chatRoomId, List<String> chatRoomEntryList, bool force, dynamic finished(int code, Map<String, int>? errors))
→ Future<void>
-
批量删除聊天室自定义属性
chatRoomId
聊天室 ID
chatRoomEntryList
聊天室属性
1. chatRoomEntryMap集合大小最大限制为 10,超过限制返回错误码 23429
2. key 支持大小写英文字母、数字、部分特殊符号 + = - _ 的组合方式,最大长度 128 个字符
value 聊天室属性对应的值,最大长度 4096 个字符
force
是否强制覆盖
finished
设置聊天室属性的回调
当 code 为 23428 的时候,errors 才会有值(key标识设置失败的 key,value 标识该 key 对应的错误码)
-
removeChatRoomEntry(String chatRoomId, String key, bool sendNotification, dynamic finished(int? code)?)
→ Future<void>
-
删除聊天室自定义属性
-
removeConversation(int conversationType, String targetId, dynamic finished(bool? success)?)
→ Future<void>
-
删除指定会话
-
removeConversationsFromTag(String? tagId, List? identifiers, dynamic finished(bool? result, int? code)?)
→ Future
-
删除指定一个标签中会话功能
tagId
标签 id
identifiers
会话列表
-
removeFromBlackList(String userId, dynamic finished(int? code)?)
→ Future<void>
-
将用户移除黑名单
-
removeMessageExpansionForKey(List keyArray, String messageUId, dynamic finished(int? code)?)
→ Future
-
删除消息扩展信息中特定的键值对
-
removeNotificationQuietHours(dynamic finished(int? code)?)
→ Future<void>
-
删除已设置的全局时间段消息提醒屏蔽
-
removeTag(String? targetId, dynamic finished(int? code)?)
→ Future<void>
-
-
removeTagsFromConversation(int? conversationType, String? targetId, List? tagIds, dynamic finished(bool? result, int? code)?)
→ Future
-
删除指定会话中的某些标签
conversationType
会话类型
targetId
会话 id
tagIds
标签 id 列表
-
saveTextMessageDraft(int? conversationType, String? targetId, String? textContent)
→ Future<bool?>
-
根据消息类型,targetId 保存某一会话的文字消息草稿。用于暂存用户输入但未发送的消息
-
searchConversations(String keyword, List conversationTypes, List objectNames, dynamic finished(int? code, List searchConversationResult)?)
→ Future<void>
-
搜索会话(根据关键词)
keyword 搜索的关键字。
conversationTypes 搜索的会话类型。
objectNames 搜索的消息类型,例如:RC:TxtMsg。
resultCallback 搜索结果回调。
-
searchMessages(int conversationType, String targetId, String keyword, int count, int beginTime, dynamic finished(List? msgList, int? code)?)
→ Future<void>
-
根据会话,搜索本地历史消息。
搜索结果可分页返回。
conversationType 指定的会话类型。
targetId 指定的会话 id。
keyword 搜索的关键字。
count 返回的搜索结果数量, count > 0。
beginTime 查询记录的起始时间, 传0时从最新消息开始搜索。从该时间往前搜索。
resultCallback 搜索结果回调。
-
sendDirectionalMessage(int? conversationType, String? targetId, List userIdList, MessageContent? content, {String? pushContent, String? pushData, dynamic finished(int messageId, int status, int code)?})
→ Future<Message?>
-
发送定向消息
-
sendDirectionalMessageWithOption(int? conversationType, String? targetId, List userIdList, MessageContent? content, SendMessageOption option, {String? pushContent, String? pushData, dynamic finished(int messageId, int status, int code)?})
→ Future<Message?>
-
发送定向消息
-
sendIntactMessageWithCallBack(Message message, String? pushContent, String? pushData, dynamic finished(int messageId, int status, int code)?)
→ Future<Message?>
-
发送消息
-
sendMessage(int conversationType, String targetId, MessageContent content, {bool disableNotification = false})
→ Future<Message?>
-
发送消息
-
sendMessageCarriesPush(int conversationType, String targetId, MessageContent content, String pushContent, String pushData, {bool disableNotification = false})
→ Future<Message?>
-
发送消息
-
sendMessageWithCallBack(int? conversationType, String? targetId, MessageContent? content, String? pushContent, String? pushData, dynamic finished(int messageId, int status, int code)?, {bool disableNotification = false})
→ Future<Message?>
-
发送消息
-
sendReadReceiptMessage(int conversationType, String targetId, int timestamp, dynamic finished(int? code)?)
→ Future<void>
-
发送某个会话中消息阅读的回执
-
sendReadReceiptRequest(Message message, dynamic finished(int? code)?)
→ Future<void>
-
请求消息阅读回执
-
sendReadReceiptResponse(int conversationType, String targetId, List messageList, dynamic finished(int? code)?)
→ Future<void>
-
发送阅读回执
-
sendTypingStatus(int conversationType, String targetId, String typingContentType)
→ Future<void>
-
发送输入状态
-
setAndroidPushConfig(PushConfig pushConfig)
→ Future<void>
-
设置推送配置(Android 第三方推送配置)
-
setChatRoomEntries(String chatRoomId, Map<String, String> chatRoomEntryMap, bool autoRemove, bool overWrite, dynamic finished(int code, Map<String, int>? errors))
→ Future<void>
-
批量设置聊天室自定义属性
chatRoomId
聊天室 ID
chatRoomEntryMap
聊天室属性
1. chatRoomEntryMap集合大小最大限制为 10,超过限制返回错误码 23429
2. key 支持大小写英文字母、数字、部分特殊符号 + = - _ 的组合方式,最大长度 128 个字符
value 聊天室属性对应的值,最大长度 4096 个字符
autoRemove
用户掉线或退出时,是否自动删除该 Key、Value 值
overWrite
是否强制覆盖
finished
设置聊天室属性的回调
当 code 为 23428 的时候,errors 才会有值(key标识设置失败的 key,value 标识该 key 对应的错误码)
-
setChatRoomEntry(String chatRoomId, String key, String value, bool sendNotification, bool autoDelete, dynamic finished(int? code)?)
→ Future<void>
-
设置聊天室自定义属性
-
setConversationNotificationStatus(int conversationType, String targetId, bool isBlocked, dynamic finished(int? status, int? code)?)
→ Future<void>
-
设置会话的提醒状态
-
setConversationToTop(int conversationType, String targetId, bool isTop, dynamic finished(bool? status, int? code)?)
→ Future<void>
-
设置会话置顶
-
setConversationToTopInTag(int? conversationType, String? targetId, String? tagId, bool? isTop, dynamic finished(bool? result, int? code)?)
→ Future
-
设置标签中会话置顶状态
conversationType
会话类型
targetId
会话 id
tagId
标签 id
isTop
是否置顶
-
设置本地消息的附加信息
-
setMessageReceivedStatus(int messageId, int receivedStatus, dynamic finished(int? code)?)
→ Future<void>
-
根据 messageId 设置接收到的消息状态。用于UI标记消息为已读,已下载等状态。
-
setMessageSentStatus(int messageId, int sentStatus, dynamic finished(int? code)?)
→ Future<void>
-
根据 messageId 设置消息的发送状态。用于UI标记消息为正在发送,对方已接收等状态。
-
setNotificationQuietHours(String startTime, int spanMins, dynamic finished(int? code)?)
→ Future<void>
-
全局屏蔽某个时间段的消息提醒
-
setOfflineMessageDuration(int duration, dynamic finished(int? code, int? result)?)
→ Future<void>
-
设置当前用户离线消息补偿时间
离线消息补偿时间是指某用户离线后,在下次登录时,服务端下发的离线消息对应的时间段。比如某应用的离线消息补偿时间是 2 天,用户离线 3 天,在第 4 天登录的时候,
服务端只会主动下发该用户第 2 天和第 3 天对应的离线消息;第 1 天的离线消息不会下发。
该功能首先需要客户提工单,在服务端开通此功能后,客户端调用该方法才生效
duration 离线消息补偿时间,参数取值范围为int值1~7天。
-
setReconnectKickEnable(bool enable)
→ Future<void>
-
设置断线重连时是否踢出当前正在重连的设备
-
setServerInfo(String naviServer, String fileServer)
→ Future<void>
-
设置服务器地址,仅限独立数据中心使用,使用前必须先联系商务开通,必须在 init 前调用
-
setStatisticServer(String statisticServer)
→ Future<void>
-
设置统计服务器的信息 仅限独立数据中心使用,使用前必须先联系商务开通。必须在 SDK init 和
setDeviceTokenData
之前进行设置。
-
syncConversationReadStatus(int conversationType, String targetId, int timestamp, dynamic finished(int? code)?)
→ Future<void>
-
同步会话阅读状态
-
typingUpdateSeconds(int typingUpdateSeconds)
→ Future<void>
-
typing 状态更新的时间,默认是 6s (仅 ios 使用,Android 请在 rc_configuration.xml 文件进行配置)
-
updateCurrentUserInfo(String userId, String name, String portraitUrl)
→ Future<void>
-
更新当前用户信息
-
updateMessageExpansion(Map expansionDic, String messageUId, dynamic finished(int? code)?)
→ Future
-
更新消息扩展信息
-
updateTag(TagInfo? taginfo, dynamic finished(int? code)?)
→ Future<void>
-