/ SDKs / Flutter
SDKs
Chat SDKs Flutter v4
Chat SDKs Flutter
Chat SDKs
Flutter
Version 4

List replies in a message thread

Copy link

You can retrieve replies to a message by identifying the parent message like the following. First, create a ThreadedMessageListParams object and set properties related to the thread where the target replies belong to.

final params = ThreadedMessageListParams()
  ..replyType = ReplyType.all
  ..previousResultSize = 10
  ..nextResultSize = 10
  ..includeParentMessageInfo = true
  ..inclusive = true;
  ..includeThreadInfo = false;

ThreadedMessageListParams

Copy link

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

Property nameTypeDescription

inclusive

boolean

Determines whether to include messages sent exactly on the specified timestamp or have the matching message ID.

previousResultSize

int

Specifies the number of messages to retrieve, which are sent previously before a specified timestamp. Note that the actual number of results may be larger than the set value when there are multiple messages with the same timestamp as the earliest message.

nextResultSize

int

Specifies the number of messages to retrieve, which are sent later after a specified timestamp. Note that the actual number of results may be larger than the set value when there are multiple messages with the same timestamp as the latest message.

includeParentMessageInfo

boolean

Determines whether to include the information of the parent messages in the result. (Default: false)

replyType

string

Specifies the type of message to include in the results.
- NONE (default): Includes unthreaded messages and only the parent messages of threaded messages.
- ALL: Includes both threaded and unthreaded messages.
- ONLY_REPLY_TO_CHANNEL: Includes unthreaded messages, parent messages of threaded messages, and messages sent to the channel as replies with the reply_to_channel property set to true.

includeThreadInfo

boolean

Determines whether to include the thread information of the messages in the result. (Default: false)

Using the timestamp of the parent message, you can retrieve the parent message with its replies by passing a ThreadedMessageListParams object as an argument to the parameter in the getThreadedMessagesByTimestamp() method.

try {
  final threadedMessages = await message.getThreadedMessagesByTimestamp(
    TIMESTAMP,
    params,
  );
  // The result includes an object that contains a parent message and its replies.
} catch (e) {
  // Handle error.
}

List of parameters

Copy link
Parameter nameTypeDescription

timestamp

int

Specifies the timestamp to be the reference point of message retrieval in Unix milliseconds format.