markAsRead method

Future<void> markAsRead()

Marks as read with current time.

After this method completes successfully, channel event ChannelEventHandler.onReadReceiptUpdated can be invoked

Implementation

Future<void> markAsRead() async {
  final now = DateTime.now().millisecondsSinceEpoch;
  if (now - _lastMarkAsReadTimestamp <= 1000) {
    throw MarkAsReadRateLimitExceededError();
  }

  _lastMarkAsReadTimestamp = now;
  final cmd = Command.buildRead(channelUrl);
  await _sdk.cmdManager.sendCommand(cmd);
}