Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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?

  @override
  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 = snapshot.data!;
            print('работаю');
            return BuildSearchItems(search);
          } else {
            print(snapshot.error);
            return const Text("No widget to build");
          }
        }
    );
  }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading