ChatMessage.createCmdSendMessage constructor

ChatMessage.createCmdSendMessage({
  1. required String targetId,
  2. required dynamic action,
  3. bool deliverOnlineOnly = false,
  4. ChatType chatType = ChatType.Chat,
})

Creates a command 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 action The command action.

Param deliverOnlineOnly Whether to send only to online users.

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.

Implementation

ChatMessage.createCmdSendMessage({
  required String targetId,
  required action,
  bool deliverOnlineOnly = false,
  ChatType chatType = ChatType.Chat,
}) : this.createSendMessage(
          chatType: chatType,
          to: targetId,
          body: ChatCmdMessageBody(
              action: action, deliverOnlineOnly: deliverOnlineOnly));