getMessage static method

Future<BaseMessage> getMessage(
  1. MessageRetrievalParams params,
  2. {Chat? chat}
)

Retrieves a BaseMessage object with a specified message ID.

Implementation

static Future<BaseMessage> getMessage(
  MessageRetrievalParams params, {
  Chat? chat,
}) async {
  sbLog.i(StackTrace.current, 'params.messageId: ${params.messageId}');
  chat ??= SendbirdChat().chat;

  if (params.messageId <= 0) throw InvalidParameterException();

  return await chat.apiClient.send<BaseMessage>(
    ChannelMessageGetRequest(
      chat,
      channelType: params.channelType,
      channelUrl: params.channelUrl,
      messageId: params.messageId,
      params: params,
    ),
  );
}