hideChat method
- ChatId id
 
override
    Marks the specified Chat as hidden for the authenticated MyUser.
Implementation
@override
Future<void> hideChat(ChatId id) async {
  Log.debug('hideChat($id)', '$runtimeType');
  RxChatImpl? chat = chats[id];
  ChatData? monologData;
  chat?.chat.update((c) => c?.isHidden = true);
  try {
    // If this [Chat] is local monolog, make it remote first.
    if (id.isLocalWith(me)) {
      monologData = _chat(
        await _graphQlProvider.createMonologChat(isHidden: true),
      );
      // Dispose and delete local monolog, since it's just been replaced with
      // a remote one.
      await remove(id);
      id = monologData.chat.value.id;
      await _monologLocal.upsert(me, monolog = id);
    }
    if (chat == null || chat.chat.value.favoritePosition != null) {
      await unfavoriteChat(id);
    }
    // [Chat.isHidden] will be changed by [RxChatImpl]'s own remote event
    // handler. Chat will be removed from [paginated] via [RxChatImpl].
    try {
      await Backoff.run(
        () async {
          await _graphQlProvider.hideChat(id);
        },
        retryIf: (e) => e.isNetworkRelated,
        retries: 10,
      );
    } on HideChatException catch (e) {
      switch (e.code) {
        case HideChatErrorCode.artemisUnknown:
          rethrow;
        case HideChatErrorCode.unknownChat:
          // No-op.
          break;
      }
    }
  } catch (_) {
    chat?.chat.update((c) => c?.isHidden = false);
    rethrow;
  }
}