How to solve this error i could not solved yet anyone help how to fix error..............................................................................................................................................................................................................
home.dart
final List _bannerImage = [];
getBanner() {
_service.home.get().then((QuerySnapshot querySnapshot) {
querySnapshot.docs.forEach((doc) {
setState(() {
_bannerImage.add(['image']);
});
});
});
}
Container(
height: 140,
width: MediaQuery.of(context).size.width,
color: Colors.grey,
child: PageView.builder(
itemCount: _bannerImage.length,
onPageChanged: (val) {
setState(() {
scrollPosition = val.toDouble();
});
},
itemBuilder: (BuildContext context, int index) {
return CachedNetworkImage(
imageUrl: _bannerImage[index],
fit: BoxFit.fill,
placeholder: (context, url) => GFShimmer(
showShimmerEffect: true,
mainColor: Colors.grey.shade500,
secondaryColor: Colors.grey.shade400,
child: Container(
height: 140,
child: const CircularProgressIndicator(),
width: MediaQuery.of(context).size.width,
color: Colors.grey,
),
),
);
// Image.network(
// _bannerImage[index],
// fit: BoxFit.cover,
// );
},
),
),
CodePudding user response:
Problem is here you add list instead of image url
_bannerImage.add(['image']);
You need to add image url like this
_bannerImage.add(doc['image']);