getFriendList API (details) to get contacts.// Obtain the contactsV2TimValueCallback<List<V2TimFriendInfo>> friendsList = await friendshipManager.getFriendList();
// Add a two-way friendV2TimValueCallback<V2TimFriendOperationResult> addFriend = await friendshipManager.addFriend(userID: "userID",remark:"Friend request remarks",addWording:"Remarks",addType:FriendTypeEnum.V2TIM_FRIEND_TYPE_BOTH);
setFriendListener to set the contacts listener.V2TIM_FRIEND_ALLOW_ANY) through the allowType field (details) in the setSelfInfo function.addFriend, after which the addType of the V2TIMFriendAddApplication request parameter can be set to either value as needed:V2TIM_FRIEND_TYPE_BOTH (two-way friend), both users A and B will receive the onFriendListAdded callback (details).V2TIM_FRIEND_TYPE_SINGLE (one-way friend), only user A will receive the onFriendListAdded callback.setFriendListener to set the contacts listener.V2TIM_FRIEND_NEED_CONFIRM) through the allowType field in the setSelfInfo function. addFriend to request to add user B as a friend. The resultCode parameter in the callback for successful API call returns 30539, indicating that the request needs to be approved by user B. In addition, both users A and B will receive the onFriendApplicationListAdded callback (details).onFriendApplicationListAdded callback. If type in the V2TIMFriendApplication parameter is V2TIM_FRIEND_APPLICATION_COME_IN, user B can accept or reject the request.acceptFriendApplication API (details) to accept the friend request. If the type is V2TIM_FRIEND_ACCEPT_AGREE (one-way friend):onFriendListAdded callback, indicating that the one-way friend was added successfully.onFriendApplicationListDeleted callback (details). At this point, user B has become a friend of user A, but not vice versa.acceptFriendApplication to accept the friend request. If the type is V2TIM_FRIEND_ACCEPT_AGREE_AND_ADD (two-way friend), both users A and B will receive the onFriendListAdded callback, indicating that they added each other as a friend successfully.refuseFriendApplication API (details) to reject the friend request, and both users will receive the onFriendApplicationListDeleted callback.// Two-way deletionV2TimValueCallback<List<V2TimFriendOperationResult>> deleteres = await friendshipManager.deleteFromFriendList(deleteType: FriendTypeEnum.V2TIM_FRIEND_TYPE_BOTH,userIDList:['user1']);
// Check whether the friend relationship is one-way or two-wayV2TimValueCallback<List<V2TimFriendCheckResult>> checkres = await friendshipManager.checkFriend(checkType:FriendTypeEnum.V2TIM_FRIEND_TYPE_BOTH,userIDList: [] );
Feedback