I have this code in SearchDelegate
class CustomSearchDelegate extends SearchDelegate<String> {
@override
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
icon: Icon(Icons.clear),
onPressed: (){
query = "";
},
)
];
}
@override
Widget buildLeading(BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back),
onPressed: (){
close(context, "");
},
);
}
@override
Widget buildResults(BuildContext context) {
close(context, query );
return Container();
}
@override
Widget buildSuggestions(BuildContext context) {
return Container();
}
}
When I run it in debug mode, it works properly. But when I run in release mode, when confirming the search, it doesn't return to the page that called Search, it just returns container, even with the "close(context, query );" before in buildResults.