search method

Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page.

Implementation

Future<List<DownloadItem>> search(DownloadQuery query) async {
  var $res =
      await promiseToFuture<JSArray>($js.chrome.downloads.search(query.toJS));
  return $res.toDart
      .cast<$js.DownloadItem>()
      .map((e) => DownloadItem.fromJS(e))
      .toList();
}