You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys,
I am developing an app and I would like to integrate it with a search function.
Basically I am going to add to my appbar a new class that will extend searchDelegate and build all the necessary things for a "modal" search.
var mySearchRes = await http.get(Uri.encodeFull("https://www.mydomain.com/wp-json/myapp/v1/search/$query/$searchIndex"), headers: {"Accept": "application/json"});
var mySearchResBody = json.decode(mySearchRes.body);
List searchList = [];
for (var modelSearches in mySearchResBody["posts"]){
searchList.add(modelSearches);
}
return searchList;
}
`
My problem is that it shows a red screen saying type 'Future<List<dynamic>>' is not a subtype of type '(int) => Future<List<dynamic>>'
when I change the pageFuture to pageFuture: BackendService().getSearchItems("flutter", 1),
where flutter is what I am searching and 1 is the page number that is retrieving 10 results at the time.
How can I fix this...
The text was updated successfully, but these errors were encountered:
Hi guys,
I am developing an app and I would like to integrate it with a search function.
Basically I am going to add to my appbar a new class that will extend searchDelegate and build all the necessary things for a "modal" search.
`
class ShowSearch extends SearchDelegate {
@OverRide
List buildActions(BuildContext context) {
// TODO: implement buildActions
return [IconButton(
icon: Icon(Icons.clear),
onPressed: (){
query = "";
}
)];
}
@OverRide
Widget buildLeading(BuildContext context) {
// TODO: implement buildLeading
return IconButton(icon: Icon(Icons.arrow_back), onPressed: (){
close(context, null);
});
}
@OverRide
Widget buildSuggestions(BuildContext context) {
// TODO: implement buildSuggestions
}
@OverRide
Widget buildResults(BuildContext context) {
// TODO: implement buildResults
int _totalCounter = 100;
}
`
and this is getSearchItems
`
static Future getSearchModels(query, searchIndex) async {
searchIndex = await searchIndex+1;
var query = "flutter";
}
`
My problem is that it shows a red screen saying
type 'Future<List<dynamic>>' is not a subtype of type '(int) => Future<List<dynamic>>'
when I change the pageFuture to
pageFuture: BackendService().getSearchItems("flutter", 1),
where flutter is what I am searching and 1 is the page number that is retrieving 10 results at the time.
How can I fix this...
The text was updated successfully, but these errors were encountered: