getMessagesByTimestamp method Null safety

Future<List<BaseMessage>> getMessagesByTimestamp(
  1. int timestamp,
  2. MessageListParams params
)

Retrieves a list of BaseMessage with given timestamp and params.

Implementation

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

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

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