Searching Group
Overview
Only locally stored groups can be searched for, such as the list of joined groups and group profiles that have been pulled.
Note:
This feature is supported by the SDK for Flutter v3.8.0 or later.
Searching a Local Group
Call the
searchGroups
API (details) to search a local group.
You can set the search keyword keywordList
and specify the search scope to set whether to search by the groupID
and groupName
fields of a group.Sample code:
// Search for a group by the keyword// Settings for group profile searchV2TimGroupSearchParam param = V2TimGroupSearchParam(isSearchGroupID: true, // Whether to search by group ID. The default value is `true`.isSearchGroupName: true, // Whether to search by group name. The default value is `true`.keywordList: []); // Search keyword list. Up to five keywords are supported.// Search a group profileV2TimValueCallback<List<V2TimGroupInfo>> searchGroupsRes =await TencentImSDKPlugin.v2TIMManager.getGroupManager().searchGroups(searchParam: param);// Settings for group profile searchif (searchGroupsRes.code == 0) {// Data found successfullysearchGroupsRes.data?.forEach((element) {element.customInfo; // Custom group fieldelement.faceUrl; // Group's profile photo URLelement.groupAddOpt; // Group adding optionselement.groupID; // Group IDelement.groupName; // Group nameelement.groupType; // Group typeelement.introduction; // Group introductionelement.isAllMuted; // Whether to mute all group memberselement.isSupportTopic; // Whether the group supports topicselement.joinTime; // Time when the current user joins the groupelement.lastInfoTime; // Time when the group profile is modified last timeelement.lastMessageTime; // Time when the last message is sent in the groupelement.memberCount; // Number of group memberselement.notification; // Group noticeelement.onlineCount; // Number of online members in the groupelement.owner; // Group ownerelement.recvOpt; // Current user's message receiving option in the groupelement.role; // Current user's role in the group});}