EMMessage.createImageSendMessage constructor Null safety

EMMessage.createImageSendMessage(
  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}
)

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.

Return The message instance.

Implementation

EMMessage.createImageSendMessage({
  required String targetId,
  required String filePath,
  String? displayName,
  String? thumbnailLocalPath,
  bool sendOriginalImage = false,
  int? fileSize,
  double? width,
  double? height,
}) : this.createSendMessage(
          to: targetId,
          body: EMImageMessageBody(
            localPath: filePath,
            displayName: displayName,
            thumbnailLocalPath: thumbnailLocalPath,
            sendOriginalImage: sendOriginalImage,
            width: width,
            height: height,
          ));