keywordList and specify the search scope to set whether to search by the userID, nickName, and remark fields of a user.// Search for a friend by keyword// Search criteriaV2TimFriendSearchParam searchParam = V2TimFriendSearchParam(isSearchNickName: true, // Whether to search by nicknameisSearchRemark: true, // Whether to search by remarksisSearchUserID: true, // Whether to search by user IDkeywordList: [], // Search keyword list. Up to five keywords are supported.);V2TimValueCallback<List<V2TimFriendInfoResult>> searchFriendsRes =await TencentImSDKPlugin.v2TIMManager.getFriendshipManager().searchFriends(searchParam: searchParam); // Search criteriaif (searchFriendsRes.code == 0) {// Queried successfullysearchFriendsRes.data?.forEach((element) {element.relation; // Friend type: `0` (Not a friend), `1` (The user is in your contacts.), `2` (You are in the user's contacts), `3` (Two-way friend)element.resultCode; // Error code (query result)element.resultInfo; // Description (query result)// friendInfo: user profile of a friend. If you are not a friend, only the userID field has a value, and other fields are empty.element.friendInfo?.friendCustomInfo; // Custom friend field. You need to first configure a custom friend field in the console (**Feature Configuration** > **Custom Friend Field**) and then call this API to specify the field.element.friendInfo?.friendGroups; // Lists to which a friend belongselement.friendInfo?.friendRemark; // Friend remarkselement.friendInfo?.userID; // User IDelement.friendInfo?.userProfile?.allowType; // Friend adding mode: `0` (Accept all friend requests), `1` (Reject all friend requests), `2` (Require approval for friend requests)element.friendInfo?.userProfile?.birthday; // User's birthdayelement.friendInfo?.userProfile?.customInfo; // User's custom statuselement.friendInfo?.userProfile?.faceUrl; // User's profile photo URLelement.friendInfo?.userProfile?.gender; // User's gender: `1` (male), `2` (female)element.friendInfo?.userProfile?.level; // User levelelement.friendInfo?.userProfile?.nickName; // User nicknameelement.friendInfo?.userProfile?.role; // User roleelement.friendInfo?.userProfile?.selfSignature; // User signatureelement.friendInfo?.userProfile?.userID; // User ID});}
Feedback