how to automatically display search results in SearchDelegate without pressing enter button on keyboard, in buildResult method?

I am using SearchDelegate, i need buildResult method to happen automatically on text input, how can i do that?

  Widget buildResults(BuildContext context) {
    return FutureBuilder<Search?>(
        future: Func.searchProducts(query),
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return buildCatalogShimmer();
          } else if (snapshot.hasData) {
            final search =!;
            return BuildSearchItems(search);
          } else {
            return const Text("No widget to build");

>Solution :

There’s another function called buildSuggestions, which is automatically showing whenever the key word changes.

You can move your business logic from buildResult into buildSuggestions instead.

Leave a Reply