Shows a loading indicator during pending search requests.
StreamBuilder
class SearchHits extends StatelessWidget { const SearchHits(this.responses, {super.key}); final Stream<SearchResponse> responses; @override Widget build(BuildContext context) { return StreamBuilder<SearchResponse>( stream: responses, builder: (context, snapshot) { if (snapshot.hasData) { // display hits list } else if (snapshot.hasError) { // display error message } else { // display loading indicator return const CircularProgressIndicator(); } }, ); } }
Was this page helpful?