/ SDKs / Flutter
SDKs
Chat SDKs Flutter v3
Chat SDKs Flutter
Chat SDKs
Flutter
Version 3
Sendbird Chat SDK v3 for Flutter is no longer supported as a new version is released. Check out our latest Chat SDK v4

Retrieve a message

Copy link

You can retrieve a specific message in an open or group channel by creating and passing the MessageRetrievalParams object as an argument into the getMessage() method.

Note: Starting from Flutter Chat SDK 3.1.0, MessageRetrievalParams requires the channelType, channelUrl, and messageId parameters.

try {
    // Create a MessageRetrievalParams object.
    final params = MessageRetrievalParams(
        messageId: MESSAGE_ID
        channelType: ChannelType.open
        channelUrl: CHANNEL_URL
    );

    // Pass the params to the parameter of the getMessage() method.
    final message = await BaseMessage.getMessage(params);
    // The specified message is successfully retrieved.
} catch (e) {
    // Handle error.
}

List of properties

Copy link

This table only contains properties shown in the code above. To see the comprehensive list of all available methods and properties, see MessageRetrievalParams.

Property nameTypeDescription

channelUrl

String

Specifies the URL of the channel.

channelType

ChannelType

Specifies the type of the channel.

messageId

Int

Specifies the unique ID of the message.


Retrieve the last message of a group channel

Copy link

You can retrieve and view the last message of a group channel.

final lastMessage = groupChannel.lastMessage;