Reputation: 51
Please can you help me or sho me an other logic ,
I tried to show show slider image from firebase, but when i run i get NetworkImage("null", scale: 1.0),
nevertheless, i get my uid
this my logic
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue[500],
body: StreamBuilder(
stream:
firebaseStore.collection('imagevehicul').doc(uid).snapshots(),
builder: (context, AsyncSnapshot<DocumentSnapshot> streamSnapshot) {
if (streamSnapshot.connectionState == ConnectionState.waiting) {
return const Text("Loading");
} else if (streamSnapshot.hasData) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
streamSnapshot.data!.data().toString()))),
child: Center(
child: Text(
uid,
style: const TextStyle(),
),
),
); // added data()
} else {
return const CircularProgressIndicator();
}
}));
}
Upvotes: -1
Views: 36
Reputation: 63769
The streamSnapshot.data!.data()
will return a list of image url.
///check the data is null or not
final images = List.from(streamSnapshot.data!.data());
return Column(
children: images
.map(
(e) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(e),
),
),
),
)
.toList(),
Upvotes: 0