getMessagesById method Null safety

Future<List<BaseMessage>> getMessagesById(
  1. int messageId,
  2. MessageListParams params
)

Retrieves a list of BaseMessage with given messageId and params.

Implementation

Future<List<BaseMessage>> getMessagesById(
  int messageId,
  MessageListParams params,
) async {
  if (messageId <= 0) {
    throw InvalidParameterError();
  }

  if (channelType == ChannelType.group) {
    params.showSubChannelMessagesOnly = false;
  }

  return _sdk.api.send<List<BaseMessage>>(
    ChannelMessagesGetRequest(
      channelType: channelType,
      channelUrl: channelUrl,
      params: params.toJson(),
      messageId: messageId,
    ),
  );
}