markAsRead method

Future<void> markAsRead()

Sends mark as read to this channel.

Implementation

Future<void> markAsRead() async {
  sbLog.i(StackTrace.current);

  final now = DateTime.now().millisecondsSinceEpoch;
  if (now - _lastMarkAsReadTimestamp <= 1000) {
    throw MarkAsReadRateLimitExceededException();
  }

  _lastMarkAsReadTimestamp = now;
  final cmd = Command.buildRead(channelUrl);
  await chat.commandManager.sendCommand(cmd);
}