Browse SDKs · Flutter
Platform
SDKsFlutter

Search friends

Search friends in the local contact list using the OpenIM Flutter SDK.

Copy

Perform local fuzzy searches across the current user's friend list matching specified keywords and field dimensions:

Parameters

ParameterTypeRequiredDescription
keywordListList<String>YesList of search keywords. Providing a list with a single non-empty keyword string is recommended.
isSearchUserIDboolNoWhether to match against the friend's user ID.
isSearchNicknameboolNoWhether to match against the friend's nickname.
isSearchRemarkboolNoWhether 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.