unfavoriteChat method
- ChatId id
 
override
    Removes the specified Chat from the favorites list of the authenticated MyUser.
Implementation
@override
Future<void> unfavoriteChat(ChatId id) async {
  Log.debug('unfavoriteChat($id)', '$runtimeType');
  if (id.isLocal) {
    return;
  }
  final RxChatImpl? chat = chats[id];
  final ChatFavoritePosition? oldPosition = chat?.chat.value.favoritePosition;
  chat?.chat.update((c) => c?.favoritePosition = null);
  paginated.emit(MapChangeNotification.updated(chat?.id, chat?.id, chat));
  try {
    try {
      await Backoff.run(
        () async {
          await _graphQlProvider.unfavoriteChat(id);
        },
        retryIf: (e) => e.isNetworkRelated,
        retries: 10,
      );
    } on UnfavoriteChatException catch (e) {
      switch (e.code) {
        case UnfavoriteChatErrorCode.unknownChat:
          await remove(id);
          break;
        case UnfavoriteChatErrorCode.artemisUnknown:
          rethrow;
      }
    }
  } catch (e) {
    chat?.chat.update((c) => c?.favoritePosition = oldPosition);
    paginated.emit(MapChangeNotification.updated(chat?.id, chat?.id, chat));
    rethrow;
  }
}