search method

Future<List<BookmarkTreeNode>> search(
  1. Object query
)

Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. query Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties query, url, and title may be specified and bookmarks matching all specified properties will be produced.

Implementation

Future<List<BookmarkTreeNode>> search(Object query) async {
  var $res = await promiseToFuture<JSArray>(
      $js.chrome.bookmarks.search(switch (query) {
    String() => query.jsify()!,
    SearchQuery() => (query.toJS as JSAny),
    _ => throw UnsupportedError(
        'Received type: ${query.runtimeType}. Supported types are: String, SearchQuery')
  }));
  return $res.toDart
      .cast<$js.BookmarkTreeNode>()
      .map((e) => BookmarkTreeNode.fromJS(e))
      .toList();
}