hideChannel method Null safety

Future<void> hideChannel(
  1. {bool hidePreviousMessage = false,
  2. bool allowAutoUnhide = true}
)

Hides this channel.

After this method completes successfully, channel event ChannelEventHandler.onChannelHidden will be invoked.

Implementation

Future<void> hideChannel({
  bool hidePreviousMessage = false,
  bool allowAutoUnhide = true,
}) async {
  final res = await _sdk.api.send(GroupChannelHideRequest(
    channelUrl,
    hidePreviousMessages: hidePreviousMessage,
    allowAutoUnhide: allowAutoUnhide,
  ));

  messageOffsetTimestamp = res?['ts_message_offset'] as int?;
  if (hidePreviousMessage) clearUnreadCount();

  isHidden = true;
  hiddenState = allowAutoUnhide
      ? GroupChannelHiddenState.allowAutoUnhide
      : GroupChannelHiddenState.preventAutoUnhide;
}