UI libraries
/
Algolia for Flutter
/
Widgets
Dec. 04, 2023
Loading
About this widget
Show a loading indicator during pending requests.
Examples
Display a loading indicator using Flutter’s StreamBuilder
.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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();
}
},
);
}
}
Did you find this page helpful?