AutoComplete / Future

191 views
Skip to first unread message

aki...@gmail.com

unread,
Apr 29, 2021, 8:18:47 AM4/29/21
to Flutter Development (flutter-dev)
Hello
I want to use the new AutoComplete class (https://api.flutter.dev/flutter/material/Autocomplete-class.html) but it's stretching my limited knowledge of futures. I need to specify an optionsBuilder which returns an Iterable<T> which is then used in optionsViewBuilder to build the dropdown selection list. The examples in the documentation and what I've found online (e.g. https://www.woolha.com/tutorials/flutter-using-autocomplete-widget-examples) do this synchronously. I want to get the optionsBuilder content from an API. How can I specify the AutoComplete constructor to work asynchronously? 

In the meantime I have implemented a solution with the https://pub.dev/packages/flutter_typeahead package - that accepts an async callback in the equivalent place. Any tips about the way forward with AutoComplete would be greatly appreciated.
Reply all
Reply to author
Forward
0 new messages