getThreadedMessagesByTimestamp method Null safety

Future<ThreadedMessageResponse> getThreadedMessagesByTimestamp(
  1. int timestamp,
  2. ThreadedMessageListParams params
)

Retrieves threaded messages (replies) on this message with timestamp and params.

Implementation

Future<ThreadedMessageResponse> getThreadedMessagesByTimestamp(
  int timestamp,
  ThreadedMessageListParams params,
) async {
  final sdk = SendbirdSdk().getInternal();
  final result = await sdk.api.getMessages(
    channelType: channelType,
    channelUrl: channelUrl,
    params: params.toJson(),
    timestamp: timestamp,
    parentMessageId: messageId,
  );

  return ThreadedMessageResponse(
    parentMessage: result.first,
    replies: result.sublist(1),
  );
}