lib/photo_list_screen.dart_cf
class PhotoListScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final User user = FirebaseAuth.instance.currentUser!;
return Scaffold(
body: StreamBuilder<QuerySnapshot<Map<String, dynamic>>>(
stream: FirebaseFirestore.instance
.collection('users/${user.uid}/photos')
.snapshots(),
builder: (context, snapshot) {
final QuerySnapshot query = snapshot.data!;
final List<String> imageList = query.docs
.map((doc) => doc.get('imageURL') as String)
.toList();
return GridView.count(
crossAxisCount: 2,
children: imageList.map((imageURL) {
return Image.network(imageURL);
}).toList(),
);
},
),
);
}
}