Create an image message
Create an image message from a platform-readable path with the OpenIM Flutter SDK.
Construct an image message object from a local filesystem image path:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
imagePath | String | Yes | Local filesystem path to the image file readable on the current device. |
Code example
final message = await OpenIM.iMManager.messageManager
.createImageMessage(imagePath: imagePath);The specified path must be an accessible file with read permissions on the current platform.
Return value
Returns a Future resolving to an image Message object ready for transmission. Detailed image properties are stored in pictureElem.
State changes after the call
Creating a message only constructs the local message data structure in memory; it does not perform network transmission, does not upload files, and does not trigger new-message event callbacks. Once constructed, pass the returned Message instance to Send a message, which handles media upload and message delivery. To create an image message from an absolute filesystem path, see Create an image message from full path; if the image is already hosted on object storage, see Create an image message by URL.
Was this page helpful?