unfollowUser method

Future<void> unfollowUser(
  1. String userId
)

Implementation

Future<void> unfollowUser(String userId) async {
  final userIDList = <String>[userId];

  try {
    await liveService.unfollowUser(userIDList: userIDList);

    userState.myFollowingUserList.value.removeWhere((userInfo) => userInfo.userId == userId);
    LinkedHashSet<UserInfo> tempList = LinkedHashSet<UserInfo>();
    tempList.addAll(userState.myFollowingUserList.value);
    userState.myFollowingUserList.value = tempList;
    getFansCount();
    ErrorHandler.onError(TUIError.success);
  } catch (error, stackTrace) {
    ErrorHandler.onError(TUIError.errFailed);
    LiveKitLogger.error('unfollowUser Error: $error\n$stackTrace');
  }
}