unfavoriteChatContact method
override
Removes the specified ChatContact from the favorites list of the authenticated MyUser.
Implementation
@override
Future<void> unfavoriteChatContact(ChatContactId id) async {
Log.debug('unfavoriteChatContact($id)', '$runtimeType');
final RxChatContactImpl? contact = paginated[id];
final ChatContactFavoritePosition? oldPosition =
contact?.contact.value.favoritePosition;
contact?.contact.update((c) => c?.favoritePosition = null);
_emit(MapChangeNotification.updated(contact?.id, contact?.id, contact));
try {
await _graphQlProvider.unfavoriteChatContact(id);
} catch (e) {
contact?.contact.update((c) => c?.favoritePosition = oldPosition);
_emit(MapChangeNotification.updated(contact?.id, contact?.id, contact));
rethrow;
}
}