King Kapeta
King Kapeta

Reputation: 51

Image provider: NetworkImage("null", scale: 1.0) Image key: NetworkImage("null", scale: 1.0)

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 colection's image enter image description here

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

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

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

Related Questions