unblockUser method
Unblocks a previously blocked user with the provided userId
.
Implementation
Future<EmptyResponse> unblockUser(String userId) async {
try {
final response = await _userBlockLock.synchronized(
() => _chatApi.user.unblockUser(userId),
);
final unblockedUserId = userId;
final currentBlockedUserIds = [...?state.currentUser?.blockedUserIds];
if (currentBlockedUserIds.contains(unblockedUserId)) {
// Remove the unblocked user from the blocked user list.
state.blockedUserIds = currentBlockedUserIds..remove(unblockedUserId);
}
return response;
} catch (e, stk) {
logger.severe('Error unblocking user', e, stk);
rethrow;
}
}