Browse SDKs · Flutter
Platform
SDKsFlutter

Create an image message from a local path

Create an image message from an absolute path with the OpenIM Flutter SDK.

Copy

Construct an image message object from an absolute filesystem path on the local device:

Parameters

ParameterTypeRequiredDescription
imagePathStringYesAbsolute filesystem path to the image file on the current device.

Code example

final message = await OpenIM.iMManager.messageManager
    .createImageMessageFromFullPath(imagePath: absolutePath);

The absolute path must exist and have read permissions on the current platform.

Return value

Returns a Future resolving to an image Message object ready for transmission. Its 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 a relative platform path, see Create an image message; if the image is already hosted on object storage, see Create an image message by URL.