getInstalledAppsPaginated method

  1. @override
Future<Page<AppInfo>> getInstalledAppsPaginated({
  1. bool includeSystemApps = false,
  2. int limit = 50,
  3. int offset = 0,
  4. String? searchQuery,
  5. AppSortBy sortBy = AppSortBy.appName,
  6. SortOrder sortOrder = SortOrder.ascending,
})
override

Implementation

@override
Future<Page<AppInfo>> getInstalledAppsPaginated({
  bool includeSystemApps = false,
  int limit = 50,
  int offset = 0,
  String? searchQuery,
  AppSortBy sortBy = AppSortBy.appName,
  SortOrder sortOrder = SortOrder.ascending,
}) async {
  final Map<dynamic, dynamic>? result = await methodChannel
      .invokeMethod('getInstalledAppsPaginated', {
        'includeSystemApps': includeSystemApps,
        'limit': limit,
        'offset': offset,
        'searchQuery': searchQuery,
        'sortBy': sortBy.name,
        'sortOrder': sortOrder.name,
      });
  if (result == null)
    return Page<AppInfo>(items: [], isLastPage: true, totalCount: 0);

  final List<dynamic> items = result['items'] ?? [];
  return Page<AppInfo>(
    items: items.map((map) => AppInfo.fromMap(map)).toList(),
    isLastPage: result['isLastPage'] ?? true,
    totalCount: result['totalCount'] ?? 0,
  );
}