tencent cloud

Tencent Cloud Super App as a Service

Searching for the Mini Program

Download
Focus Mode
Font Size
Last updated: 2025-04-03 17:53:12

Search mini programs

keyWord: The keyword used to search the mini program.
searchAppType:the scope to be searched, refer to SearchAppType.
category: category information of the mini program.
pageInfo:specify the page index and size when searching.
Future<SearchMiniAppResult?> searchMiniApp(
String keyword, {
SearchAppType searchAppType = SearchAppType.searchAppTypeAll,
CategoryInfo? category = const CategoryInfo(),
PageInfo? pageInfo = const PageInfo()
})
Example:
Future<void> doSearch() async {
FocusScope.of(context).unfocus();
final result = await _tcmppFlutterPlugin
.searchMiniApp(
searchController.text,
category: CategoryInfo(
mainCategory: firstTypeController.text,
subCategory: secondTypeController.text
)
)
.catchError((err) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(err.toString())));
});

setState(() {
_appInfoList.clear();
if (result != null && result.appInfoList.isNotEmpty) {
_appInfoList.addAll(result.appInfoList);
_emptyText = 'Total: ${result.total}, Current: ${result.appInfoList.length}';
} else {
_emptyText = 'No mini app found';
}
});
}

Get categories

Get all categories
existMnpOnly:Whether to get only the list of currently published mini programs.
searchAppType:the scope to be searched, refer to SearchAppType.
Future<List<CategoryInfo>?> getCategoryList(bool existMnpOnly,SearchAppType searchAppType)
Example:

List<CategoryInfo>? ctList = await _tcmppFlutterPlugin.getCategoryList(true, SearchAppType.searchAppTypeAll);
if (ctList != null) {
for (var i = 0; i < ctList.length; i++) {
print('Main Category: ${ctList[i].mainCategory}');
print('Sub Category: ${ctList[i].subCategory}');
}
}


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback