EMMessage.createTxtSendMessage constructor

EMMessage.createTxtSendMessage({
  1. required String targetId,
  2. required String content,
  3. List<String>? targetLanguages,
  4. ChatType chatType = ChatType.Chat,
})

~english Creates a text message for sending.

Param targetId The ID of the message recipient.

  • For a one-to-one chat, it is the user ID of the peer user.
  • For a group chat, it is the group ID.
  • For a chat room, it is the chat room ID.

Param content The text content.

Param targetLanguages Target languages.

Param chatType The chat type. The default chat type is one-to-one chat. For the group chat or chat room, see ChatType.

Return The message instance. ~end

~chinese 创建一条文本消息。

Param targetId 消息接收方,可以是:

  • 用户:用户 ID;
  • 群组:群组 ID;
  • 聊天室:聊天室 ID。

Param content 文本消息内容。

Param targetLanguages 目标语言。

Param chatType 聊天类型, 默认为单聊,如果是群聊或者聊天室,可以参考ChatType

Return 消息体实例。 ~end

Implementation

EMMessage.createTxtSendMessage({
  required String targetId,
  required String content,
  List<String>? targetLanguages,
  ChatType chatType = ChatType.Chat,
}) : this.createSendMessage(
        chatType: chatType,
        to: targetId,
        body: EMTextMessageBody(
          content: content,
          targetLanguages: targetLanguages,
        ),
      );