Skip to main content

Querying With Search

You can get a list of pages with a search query using the search(), and you can use it like this:

YouCan.instance.pages.search("YOUR SEARCH TEXT HERE");

and you can make a request for it using all(), like the following.

Using await/async :

final pagesStartingWithCo = await YouCan.instance.pages.search("co").all();

Using A FutureBuilder :

FutureBuilder<List<Page>>(
future: YouCan.instance.pages.search("co").all(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data);
} else if (snapshot.hasError) {
return Text("Error: ${snapshot.error}");
} else {
return CircularProgressIndicator();
}
},
),