searchFriends

Introduction

Search friends with some conditions.

It will returns the user profile cached in local, while you can check the relationship with V2TIMFriendInfoResult.

This method can only search locally.

Supports since version 3.8.

Parameter details

Parameter name Parameter type Required Platform Description
searchParam V2TimFriendSearchParam yes All The conditions for searching.

Returned template

V2TimValueCallback<List<V2TimFriendInfoResult>>

{
    code : int
    desc : String
    data : List<V2TimFriendInfoResult>
}

Return value details

name type description
code int Request result: Error codes. 0 means success.
desc String The description of the error. It will be empty if success.
data List< V2TimFriendInfoResult > The list of search result.

Code example

    V2TimFriendSearchParam searchParam = V2TimFriendSearchParam(
      isSearchNickName: true,
      isSearchRemark: true,
      isSearchUserID: true,
      keywordList: [],
    );
    V2TimValueCallback<List<V2TimFriendInfoResult>> searchFriendsRes =
        await TencentImSDKPlugin.v2TIMManager
            .getFriendshipManager()
            .searchFriends(searchParam: searchParam); 
    if (searchFriendsRes.code == 0) {
      searchFriendsRes.data?.forEach((element) {
        element.relation; 
        element.resultCode; 
        element.resultInfo; 
        element.friendInfo
            ?.friendCustomInfo; 
        element.friendInfo?.friendGroups; 
        element.friendInfo?.friendRemark; 
        element.friendInfo?.userID; 
        element.friendInfo?.userProfile
            ?.allowType; 
        element.friendInfo?.userProfile?.birthday; 
        element.friendInfo?.userProfile?.customInfo; 
        element.friendInfo?.userProfile?.faceUrl; 
        element.friendInfo?.userProfile?.gender; 
        element.friendInfo?.userProfile?.level; 
        element.friendInfo?.userProfile?.nickName; 
        element.friendInfo?.userProfile?.role; 
        element.friendInfo?.userProfile?.selfSignature; 
        element.friendInfo?.userProfile?.userID; 
      });
    }

results matching ""

    No results matching ""