removeChatMember method

  1. @override
Future<void> removeChatMember(
  1. ChatId chatId,
  2. UserId userId
)
override

Removes an User from a Chat-group by the authority of the authenticated MyUser.

Implementation

@override
Future<void> removeChatMember(ChatId chatId, UserId userId) async {
  Log.debug('removeChatMember($chatId, $userId)', '$runtimeType');

  final RxChatImpl? chat = chats[chatId];
  final DtoChatMember? member = chat?.members.pagination?.items[userId];

  chat?.members.remove(userId);

  try {
    await _graphQlProvider.removeChatMember(chatId, userId);
  } catch (_) {
    if (member != null) {
      chat?.members.put(member);
    }

    rethrow;
  }

  await onMemberRemoved.call(chatId, userId);
}