Skip to content

Commit d478152

Browse files
committed
bug fix in image_favorites_page.dart
1 parent 987d866 commit d478152

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

lib/views/image/image_favorites_page.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ class _ImageFavoritesPageState extends State<ImageFavoritesPage> {
3838
@override
3939
void initState() {
4040
super.initState();
41-
_imageFuture = fetchFavorites();
41+
_imageFuture = fetchFavorites().then((response) {
42+
if (response.hasData) {
43+
setState(() {
44+
final int? total = response.data!['total_count'];
45+
if (total != null) {
46+
_nbImages = total;
47+
}
48+
_imageList = response.data!['images'].cast<ImageModel>() ?? [];
49+
});
50+
}
51+
return response;
52+
});
4253
}
4354

4455
@override

0 commit comments

Comments
 (0)