Search friends
Search friends in the local contact list using the OpenIM Flutter SDK.
Perform local fuzzy searches across the current user's friend list matching specified keywords and field dimensions:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
keywordList | List<String> | Yes | List of search keywords. Providing a list with a single non-empty keyword string is recommended. |
isSearchUserID | bool | No | Whether to match against the friend's user ID. |
isSearchNickname | bool | No | Whether to match against the friend's nickname. |
isSearchRemark | bool | No | Whether to match against the friend's remark. |
Code example
final results = await OpenIM.iMManager.friendshipManager.searchFriends(
keywordList: ['alice'],
isSearchUserID: true,
isSearchNickname: true,
isSearchRemark: true,
);Return value
A successful Future returns a list of matching friend search results (List<SearchFriendsInfo>).
Each SearchFriendsInfo object contains friend profile data alongside matched attributes. Search results should power temporary search views and must not replace the persistent global contact roster. When opening conversations or navigating from search results, use the candidate's userID as the unique entity key.
This operation executes locally against the client database and does not trigger friend listener callbacks. To load the regular friend list, see Get friend list with pagination.
Was this page helpful?