ChatMessage.createImageSendMessage constructor

  1. {required String targetId,
  2. required String filePath,
  3. String? displayName,
  4. String? thumbnailLocalPath,
  5. bool sendOriginalImage = false,
  6. int? fileSize,
  7. double? width,
  8. double? height,
  9. ChatType chatType = ChatType.Chat}

Creates an image message for sending.

Param targetId The ID of the message recipient.

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

Param filePath The image path.

Param displayName The image name.

Param thumbnailLocalPath The local path of the image thumbnail.

Param sendOriginalImage Whether to send the original image.

  • true: Yes.
  • false: (default) No. For an image greater than 100 KB, the SDK will compress it and send the thumbnail.

Param fileSize The image file size in bytes.

Param width The image width in pixels.

Param height The image height in pixels.

Param chatType The chat type, default is single chat, if it is group chat or chat room, see ChatType.

Return The message instance.


  required String targetId,
  required String filePath,
  String? displayName,
  String? thumbnailLocalPath,
  bool sendOriginalImage = false,
  int? fileSize,
  double? width,
  double? height,
  ChatType chatType = ChatType.Chat,
}) : this.createSendMessage(
          chatType: chatType,
          to: targetId,
          body: ChatImageMessageBody(
            localPath: filePath,
            displayName: displayName,
            thumbnailLocalPath: thumbnailLocalPath,
            sendOriginalImage: sendOriginalImage,
            width: width,
            height: height,