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 offset = await _sdk.api.hideGroupChannel(
    channelUrl: channelUrl,
    hidePreviousMessages: hidePreviousMessage,
    allowAutoUnhide: allowAutoUnhide,
  );

  if (offset != null) messageOffsetTimestamp = offset;
  if (hidePreviousMessage) clearUnreadCount();

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