EMMessage class

~english The message class.

The sample code for constructing a text message to send is as follows.

  EMMessage msg = EMMessage.createTxtSendMessage(
     username: "user1",
     content: "hello",
   );

~end

~chinese 消息对象类。

创建一条待发送的文本消息示例代码如下:

  EMMessage msg = EMMessage.createTxtSendMessage(
     targetId: "user1",
     content: "hello",
   );

~end

Constructors

EMMessage.createCmdSendMessage({required String targetId, required dynamic action, bool deliverOnlineOnly = false, ChatType chatType = ChatType.Chat})
~english Creates a command message for sending.
EMMessage.createCombineSendMessage({required String targetId, String? title, String? summary, String? compatibleText, required List<String> msgIds, ChatType chatType = ChatType.Chat})
~english Creates a combined message for sending.
EMMessage.createCustomSendMessage({required String targetId, required dynamic event, Map<String, String>? params, ChatType chatType = ChatType.Chat})
~english Creates a custom message for sending.
EMMessage.createFileSendMessage({required String targetId, required String filePath, String? displayName, int? fileSize, ChatType chatType = ChatType.Chat})
~english Creates a file message for sending.
EMMessage.createImageSendMessage({required String targetId, required String filePath, String? displayName, String? thumbnailLocalPath, bool sendOriginalImage = false, int? fileSize, double? width, double? height, ChatType chatType = ChatType.Chat})
~english Creates an image message for sending.
EMMessage.createLocationSendMessage({required String targetId, required double latitude, required double longitude, String? address, String? buildingName, ChatType chatType = ChatType.Chat})
~english Creates a location message for sending.
EMMessage.createReceiveMessage({required EMMessageBody body, ChatType chatType = ChatType.Chat})
~english Creates a received message instance.
EMMessage.createSendMessage({required EMMessageBody body, String? to, ChatType chatType = ChatType.Chat})
~english Creates a message instance for sending.
EMMessage.createTxtSendMessage({required String targetId, required String content, List<String>? targetLanguages, ChatType chatType = ChatType.Chat})
~english Creates a text message for sending.
EMMessage.createVideoSendMessage({required String targetId, required String filePath, String? displayName, int duration = 0, int? fileSize, String? thumbnailLocalPath, double? width, double? height, ChatType chatType = ChatType.Chat})
~english Creates a video message instance for sending.
EMMessage.createVoiceSendMessage({required String targetId, required String filePath, int duration = 0, int? fileSize, String? displayName, ChatType chatType = ChatType.Chat})
~english Creates a voice message for sending.

Properties

attributes Map<String, dynamic>?
~english Message's extension attribute. ~end
getter/setter pair
body ↔ EMMessageBody
~english Message body. We recommend you use EMMessageBody. ~end
getter/setter pair
chatroomMessagePriority ChatRoomMessagePriority
~english Sets the priority of chat room messages. param priority The priority of chat room messages. The default value is Normal, indicating the normal priority. For details, seeChatRoomMessagePriority. ~end
no getter
chatType ChatType
~english The enumeration of the chat type.
getter/setter pair
conversationId String?
~english The conversation ID. ~end
getter/setter pair
deliverOnlineOnly bool
~english Whether the message is delivered only when the recipient(s) is/are online:
getter/setter pair
direction MessageDirection
~english The message direction. see MessageDirection. ~end
getter/setter pair
from String?
~english The ID of the message sender.
getter/setter pair
hasDeliverAck bool
~english The delivery receipt, which is to check whether the other party has received the message.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasRead bool
~english Whether the message is read.
getter/setter pair
hasReadAck bool
~english Whether the recipient has read the message.
getter/setter pair
isBroadcast bool
~english Whether it is a global broadcast message ~end
latefinal
isChatThreadMessage bool
~english Is it a message sent within a thread ~end
getter/setter pair
localTime int
~english The local timestamp when the message is created on the local device, in milliseconds. ~end
getter/setter pair
msgId String
~english Gets the message ID.
no setter
needGroupAck bool
~english Whether read receipts are required for group messages.
getter/setter pair
onlineState bool
~english Message Online Status
latefinal
receiverList List<String>?
~english The recipient list of a targeted message.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverTime int
~english The timestamp when the message is received by the server. ~end
getter/setter pair
status MessageStatus
~english Gets the message sending/reception status. see MessageStatus. ~end
getter/setter pair
to String?
~english The ID of the message recipient.
getter/setter pair

Methods

chatThread() Future<EMChatThread?>
~english Get an overview of the thread in the message (currently only supported by group messages)
dispose() → void
groupAckCount() Future<int>
~english Gets the number of members that have read the group message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reactionList() Future<List<EMMessageReaction>>
~english Gets the Reaction list.
toString() String
A string representation of this object.
override

Operators

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