Messages with ParentMessages not showing up in query


I am using sendbird-flutter SDK v 3.1.7.

When I use message threading and reply to a parent message, I can see the reply thread. I have tested this by loggong in on two emulators, and replying to a message sent from the first emulator in the second emulator in a thread. However, when I then do a query to load channel messages, none of the messages which have a parent message are retrieved:

The code I am using to retrieve the channel messages is:

  Future<void> loadMessages({
    int? timestamp,
    bool reload = false,
  }) async {
    if (isLoading) {

    isLoading = true;

    final ts = reload ? : timestamp!;
    try {

      final params = MessageListParams()
        ..includeThreadInfo = true
        ..includeReplies = true
        ..isInclusive = false
        ..includeParentMessageText = true
        ..reverse = true
        ..previousResultSize = 20;
      final messages = await channel!.getMessagesByTimestamp(ts, params);
      _messages = reload ? messages : _messages + messages;
      for(BaseMessage message in _messages) {
        print("PARENT: ${message.parentMessageId
        }, ORIGINAL: ${message.message}");
      print('PARENT LAST MSG: ${channel!.lastMessage!.parentMessageId} CHANNEL MESSAGE LAST: ${channel!.lastMessage!.message}');
      hasNext = messages.length == 20;
      isLoading = false;
      if (!isDisposed) notifyListeners();
    } catch (e) {
      isLoading = false;
      print('group_channel_view.dart: getMessages: ERROR: $e');

The print statements are just to highlight the difference when channel!.lastMessage has a parent it doesn’t appear in the results of the query

I get similar results when querying the platform API, so it seems like it’s not only a Flutter issue?

Hi @Nicholas_Latham,

Could you please DM me the AppID, channel_url, message_ts, and an example message_id so I can look into this for you?

After testing the message params, using ..replyType = ReplyType.all instead of using ..includeReplies = true resolved the issue. includeReplies has been deprecated.

The same goes for the Platform API, include_replies has been deprecated, and include_reply_types is the new parameter.

See the docs for the full list of parameters on the Platform API here:

1 Like