MessageService class Null safety

Constructors

MessageService()
factory

Properties

hashCode int
The hash code for this object.
read-only, inherited
onAttachmentProgress Stream<NIMAttachmentProgress>
Listen to the upload progresses of message attachments.
read-only
onBroadcastMessage Stream<NIMBroadcastMessage>
Listen to the receiving of broadcast messages.
read-only
onMessage Stream<List<NIMMessage>>
Listen to message receiving.
read-only
onMessagePinNotify Stream<NIMMessagePinEvent>
Listen to the events of pinning messages.
read-only
onMessageReceipt Stream<List<NIMMessageReceipt>>
Listen to message read receipts.
read-only
onMessageRevoked Stream<NIMRevokeMessage>
Listen to the recalling of messages.
read-only
onMessageStatus Stream<NIMMessage>
Listen to message status updates.
read-only
onMySessionUpdate Stream<RecentSession>
Listen to conversation updates (conversation service).
read-only
onQuickCommentAdd Stream<NIMHandleQuickCommentOption>
Listen to the adding of a quick comment.
read-only
onQuickCommentRemove Stream<NIMHandleQuickCommentOption>
Listen to the deletion of a quick comment.
read-only
onSessionDelete Stream<NIMSession>
Listen to the deletion of conversations.
read-only
onSessionUpdate Stream<List<NIMSession>>
Listen to the updates of conversations.
read-only
onStickTopSessionAdd Stream<NIMStickTopSessionInfo>
Listen to the multi-device synchronization of the adding of a pinned conversation.
read-only
onStickTopSessionRemove Stream<NIMStickTopSessionInfo>
Listen to the multi-device synchronization of the removal of a pinned conversation.
read-only
onStickTopSessionUpdate Stream<NIMStickTopSessionInfo>
Listen to the multi-device synchronization of the extension field updates of a pinned conversation.
read-only
onSyncStickTopSession Stream<List<NIMStickTopSessionInfo>>
Listen to the multi-device synchronization of the pinned conversations.
read-only
onTeamMessageReceipt Stream<List<NIMTeamMessageReceipt>>
Listen to the read receipts of group messages.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addCollect({required int type, required String data, String? ext, String? uniqueId}) Future<NIMResult<NIMCollectInfo>>
Add a message to the favorites.
addMessagePin(NIMMessage message, String? ext) Future<NIMResult<void>>
Pin a message.
addQuickComment(NIMMessage msg, int replyType, String ext, bool needPush, bool needBadge, String pushTitle, String pushContent, Map<String, Object> pushPayload) Future<NIMResult<int>>
Add a quick comment.
addStickTopSession(String sessionId, NIMSessionType sessionType, String ext) Future<NIMResult<NIMStickTopSessionInfo>>
Add a pinned conversation.
cancelUploadAttachment(NIMMessage message) Future<NIMResult<void>>
Cancel downloading the message attachment.
checkLocalAntiSpam(String content, String replacement) Future<NIMResult<NIMLocalAntiSpamResult>>
Scan text messages of one-to-one chats, group chats, and chatroom against the SDK's list of undesirable terms. You need to configure the term list on the CommsEase Console and apply it to the SDK.
clearAllSessionUnreadCount() Future<NIMResult<void>>
Clear the unread counts of all conversations.
clearChattingHistory(String account, NIMSessionType sessionType) Future<void>
Query messages by server ID.
clearMsgDatabase(bool clearRecent) Future<void>
Query messages by server ID.
clearServerHistory(String sessionId, NIMSessionType sessionType, bool sync) Future<void>
Delete the history messages of a conversation from the cloud.
clearSessionUnreadCount(List<NIMSessionInfo> sessionInfoList) Future<NIMResult<List<NIMSessionInfo>>>
Batch clear the unread count of specific conversations.
createSession({required String sessionId, required NIMSessionType sessionType, int tag = 0, required int time, bool linkToLastMessage = false}) Future<NIMResult<NIMSession>>
Create an empty conversation and save it to the database.
sessionId - The conversation ID
sessionType - The conversation type
tag - The conversation tag, for example, it can be the tag representing that the conversation is pinned (implemented in the UIKit: RECENT_TAG_STICKY ); you can customize it as required; pass 0 if you do not need the customization.
time - The conversation time (unit: ms)
linkToLastMessage - Specify whether to include the information of the last message.
deleteChattingHistory(NIMMessage anchor, bool ignore) Future<void>
Delete a history message.
deleteChattingHistoryList(List<NIMMessage> msgList, bool ignore) Future<void>
Specify multiple messages and delete them from the local message database.
deleteMsgListSelf(List<NIMMessage> msgList, String ext) Future<NIMResult<int>>
Delete multiple history messages from the cloud.
deleteMsgSelf(NIMMessage msg, String ext) Future<NIMResult<int>>
Delete a history message from the cloud.
deleteMySession(List<NIMMySessionKey> sessionList) Future<NIMResult<void>>
【Conversation Service】Delete conversations.
deleteSession({required NIMSessionInfo sessionInfo, required NIMSessionDeleteType deleteType, required bool sendAck}) Future<NIMResult<void>>
Delete a conversation. After you call the API, the SDK will trigger the MessageService.onSessionDelete notification.
downloadAttachment({required NIMMessage message, required bool thumb}) Future<NIMResult<void>>
In normal cases, once a message is received, its attachment will be downloaded automatically. If the download fails, you can call this API to download again. message: the message that contains the attachment, thumb: (only valid for image messages and video messages) download the thumbnail or the original file; if you pass in true, the thumbnail will be downloaded.
fetchTeamMessageReceiptDetail({required NIMMessage message, List<String>? accountList}) Future<NIMResult<NIMTeamMessageAckInfo>>
The sender of a group message remotely queries users who have read and have not read the message among specified users.
forwardMessage(NIMMessage message, String sessionId, NIMSessionType sessionType) Future<NIMResult<void>>
Forward a message. Supports updating the application extension field of the message in the application's local database.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
pullMessageHistory(NIMMessage anchor, int limit, bool persist) Future<NIMResult<List<NIMMessage>>>
Get history messages from the server, the obtained history messages will not be saved into the local message database.
pullMessageHistoryExType(NIMMessage anchor, int toTime, int limit, QueryDirection direction, List<NIMMessageType> messageTypeList, bool persist) Future<NIMResult<List<NIMMessage>>>
Get specified types of history messages from the server, the obtained history messages will not be saved into the local message database.
queryCollect({NIMCollectInfo? anchor, int toTime = 0, int? type, int limit = 100, QueryDirection direction = QueryDirection.QUERY_OLD}) Future<NIMResult<NIMCollectInfoQueryResult>>
Query the favorites list by page from the CommsEase server.
queryLastMessage(String account, NIMSessionType sessionType) Future<NIMResult<NIMMessage>>
Query the last message.
queryMessageList(String account, NIMSessionType sessionType, int limit) Future<NIMResult<List<NIMMessage>>>
Query messages.
@Deprecated('queryMessageListEx')
queryMessageListByUuid(List<String> uuids, String sessionId, NIMSessionType sessionType) Future<NIMResult<List<NIMMessage>>>
Query messages by UUID.
queryMessageListEx(NIMMessage anchor, QueryDirection direction, int limit) Future<NIMResult<List<NIMMessage>>>
Query messages.
queryMessagePinForSession(String sessionId, NIMSessionType sessionType) Future<NIMResult<List<NIMMessagePin>>>
Query all pinned messages of a specific conversation.
queryMySession(String sessionId, NIMSessionType sessionType) Future<NIMResult<RecentSession>>
【Conversation Service】Get a conversation.
queryMySessionList(int minTimestamp, int maxTimestamp, int needLastMsg, int limit, int hasMore) Future<NIMResult<RecentSessionList>>
【Conversation service】Obtain conversations by page.
queryQuickComment(List<NIMMessage> msgList) Future<NIMResult<List<NIMQuickCommentOptionWrapper>>>
Get the quick comment list.
queryReplyCountInThreadTalkBlock(NIMMessage msg) Future<NIMResult<int>>
Get the number of replies in a specific message thread.
querySession(NIMSessionInfo sessionInfo) Future<NIMResult<NIMSession>>
Query the list of recent conversations. You can set an upper limit for the number of returned conversations to avoid data overload. sessionInfo - The conversation information
querySessionList([int? limit]) Future<NIMResult<List<NIMSession>>>
Get the list of recent conversations.
querySessionListFiltered(List<NIMMessageType> filterMessageTypeList) Future<NIMResult<List<NIMSession>>>
Call the API below to filter the type of the last messages of conversations.
queryStickTopSession() Future<NIMResult<List<NIMStickTopSessionInfo>>>
Query the pinned conversations.
queryTeamMessageReceiptDetail({required NIMMessage message, List<String>? accountList}) Future<NIMResult<NIMTeamMessageAckInfo>>
Query in the local database the users who have read and have not read a group message. /// Note: The data got through this API is much older than the data prior to offline.
queryThreadTalkHistory({required NIMMessage anchor, required int fromTime, required int toTime, required int limit, required QueryDirection direction, required bool persist}) Future<NIMResult<NIMThreadTalkHistory>>
Specify the parent message in a message thread (stored on the cloud) to query the parent message's replies. Message threads in one-to-one chats, group chats, and super-group chats support this feature.
queryTotalUnreadCount({NIMUnreadCountQueryType queryType = NIMUnreadCountQueryType.all}) Future<NIMResult<int>>
Get the total unread count.
refreshTeamMessageReceipt(List<NIMMessage> messageList) Future<NIMResult<void>>
The sender of a group message batch refreshes the message's read count and unread count. The operation will not trigger an asynchronous callback. If the read count or unread count updates, listen to onTeamMessageReceipt to get corresponding notifications.
removeCollect(List<NIMCollectInfo> collects) Future<NIMResult<int>>
Batch remove messages from the favorites.
removeMessagePin(NIMMessage message, String? ext) Future<NIMResult<void>>
Remove a pinned message.
removeQuickComment(NIMMessage msg, int replyType, String ext, bool needPush, bool needBadge, String pushTitle, String pushContent, Map<String, Object> pushPayload) Future<NIMResult<void>>
Delete a quick comment.
removeStickTopSession(String sessionId, NIMSessionType sessionType, String ext) Future<NIMResult<void>>
Delete a pinned conversation.
replyMessage({required NIMMessage msg, required NIMMessage replyMsg, required bool resend}) Future<NIMResult<void>>
Reply a message.
msg The message to be sent. It is constructed by {@link MessageBuilder}. replyMsg The message that was replied to resend Pass in "true" if the message needs to be resent after it fails to be sent, otherwise pass in "false". Future You can set the callback function. The callback function will be invoked only when the message is sent successfully. If errors occur, error codes will be returned.
revokeMessage({required NIMMessage message, String? customApnsText, Map<String, Object>? pushPayload, bool? shouldNotifyBeCount, String? postscript, String? attach}) Future<NIMResult<void>>
Recall a message.
saveMessage({required NIMMessage message, required String fromAccount}) Future<NIMResult<NIMMessage>>
Save a message.
searchAllMessage(MessageSearchOption searchOption) Future<NIMResult<List<NIMMessage>>>
Search all messages.
searchCloudMessageHistory(MessageKeywordSearchConfig config) Future<NIMResult<List<NIMMessage>>>
Search all cloud messages.
searchMessage(NIMSessionType sessionType, String sessionId, MessageSearchOption searchOption) Future<NIMResult<List<NIMMessage>>>
Search the messages of a conversation.
searchRoamingMsg(String otherAccid, int fromTime, int endTime, String keyword, int limit, bool reverse) Future<NIMResult<List<NIMMessage>>>
Search cloud messages of one-to-one chats.
sendAudioMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, required int fileSize, required int duration, String? displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send an audio message.
sendCustomMessage({required String sessionId, required NIMSessionType sessionType, String? content, NIMMessageAttachment? attachment, NIMCustomMessageConfig? config, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send a custom message.
sendFileMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, int? fileSize, required String displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send a file (document) message.
sendImageMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, required int fileSize, String? displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send an image message.
sendLocationMessage({required String sessionId, required NIMSessionType sessionType, required double latitude, required double longitude, required String address, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send a location message.
sendMessage({required NIMMessage message, bool resend = false}) Future<NIMResult<NIMMessage>>
Send a message. If you need to update the sending progress, listen to onMessageStatus. Listen to onAttachmentProgress if required, which represents the sending progress of the attachment. Pass in the resend parameter if you need to resend a message once it fails to be sent.
sendMessageReceipt({required String sessionId, required NIMMessage message}) Future<NIMResult<void>>
Send a read receipt in the one-to-one chat scenario. Listen to onMessageReceipt if required, which represents read receipts in the one-to-one chat scenario.
sendTeamMessageReceipt(NIMMessage message) Future<NIMResult<void>>
Send a read receipt in the group chat scenario. Listen to onTeamMessageReceipt, if required, which represents read receipts in the group chat scenario.
sendTextMessage({required String sessionId, required NIMSessionType sessionType, required String text, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send a text message.
sendTipMessage({required String sessionId, required NIMSessionType sessionType, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send a tip message.
sendVideoMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, int? fileSize, required int duration, required int width, required int height, required String displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm, bool resend = false, MessageAction? action}) Future<NIMResult<NIMMessage>>
Send a video message.
setChattingAccount({required String sessionId, required NIMSessionType sessionType}) Future<NIMResult<void>>
Reset the unread count of the current conversation (only available for the Android platform). Call the API below to reset the unread count of the current conversation. The SDK will automatically manage the unread count. The API will automatically call clearUnreadCount(String, SessionTypeEnum) to clear the unread count of the current conversation. When a new message is delivered from the chat partner, the unread count will not increase.
toString() String
A string representation of this object.
inherited
updateCollect(NIMCollectInfo info) Future<NIMResult<NIMCollectInfo>>
Update a favorite's extension field.
updateMessage(NIMMessage message) Future<NIMResult<void>>
Update a message. Supports updating the application extension field of the messages stored in the application database.
updateMessagePin(NIMMessage message, String? ext) Future<NIMResult<void>>
Update a message's pin information.
updateMySession(String sessionId, NIMSessionType sessionType, String ext) Future<NIMResult<void>>
【Conversation Service】Update a conversation by setting the extension field; if the conversation to be updated does not exist, it will be created and the created one has no lastMsg.
updateSession({required NIMSession session, bool needNotify = false}) Future<NIMResult<void>>
Update a conversation.
updateSessionWithMessage({required NIMMessage message, bool needNotify = false}) Future<NIMResult<void>>
Update a messaage in a conversation to update the conversation.
updateStickTopSession(String sessionId, NIMSessionType sessionType, String ext) Future<NIMResult<void>>
Update the extension field of the pinned conversation.
voiceToText({required NIMMessage message, String? scene}) Future<NIMResult<String>>
Convert audio to text.

Operators

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