EMMessage class Null safety

The message class.

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

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

Constructors

EMMessage.createCmdSendMessage({required String targetId, required dynamic action, bool deliverOnlineOnly = false})
Creates a command message for sending.
EMMessage.createCustomSendMessage({required String targetId, required dynamic event, Map<String, String>? params})
Creates a custom message for sending.
EMMessage.createFileSendMessage({required String targetId, required String filePath, String? displayName, int? fileSize})
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})
Creates an image message for sending.
EMMessage.createLocationSendMessage({required String targetId, required double latitude, required double longitude, String? address, String? buildingName})
Creates a location message for sending.
EMMessage.createReceiveMessage({required EMMessageBody body})
Creates a received message instance.
EMMessage.createSendMessage({required EMMessageBody body, String? to})
Creates a message instance for sending.
EMMessage.createTxtSendMessage({required String targetId, required String content, List<String>? targetLanguages})
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})
Creates a video message instance for sending.
EMMessage.createVoiceSendMessage({required String targetId, required String filePath, int duration = 0, int? fileSize, String? displayName})
Creates a voice message for sending.

Properties

attributes Map?
Message's extension attribute.
read / write
body ↔ EMMessageBody
Message body. We recommend you use {@link EMMessageBody)}.
read / write
chatType ChatType
The enumeration of the chat type.
read / write
conversationId String?
The conversation ID.
read / write
direction MessageDirection
The message direction. see {@link MessageDirection}
read / write
from String?
The ID of the message sender.
read / write
groupAckCount int
Gets the number of members that have read the group message.
@Deprecated("Switch to using EMMessage#groupAckCount instead."), read-only
hasDeliverAck bool
The delivery receipt, which is to check whether the other party has received the message.
read / write
hashCode int
The hash code for this object.
read-only, inherited
hasRead bool
Whether the message is read.
read / write
hasReadAck bool
Whether the recipient has read the message.
read / write
isChatThreadMessage bool
Is it a message sent within a thread
read / write
listener StatusListener?
@Deprecated("Switch to using messageStatusCallBack instead."), read / write
localTime int
The local timestamp when the message is created on the local device, in milliseconds.
read / write
msgId String
Gets the message ID.
read-only
needGroupAck bool
Whether read receipts are required for group messages.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
serverTime int
The timestamp when the message is received by the server.
read / write
status MessageStatus
Gets the message sending/reception status. see {@link MessageStatus}
read / write
to String?
The ID of the message recipient.
read / write

Methods

dispose() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
setMessageStatusCallBack(MessageStatusCallBack? callback) → void
setMessageStatusListener(StatusListener? listener) → void
@Deprecated("Switch to using messageStatusCallBack instead.")
toString() String
A string representation of this object.
override

Operators

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