i want to fetch the image of my products in my flutter app ...
but i cant it show me this weird error and i don't know what is it for?
and this is my code ( exactly based on a tutorial that worked for the teacher) :
class _MyPageState extends State<MyPage> {
late List<Product>? listproduct;
@override
void initState() {
fetchAllProducts().then((value) => listproduct = value);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder(
future: fetchAllProducts(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ListView.builder(
itemCount: listproduct!.length,
itemBuilder: (context, index) {
return Card(
child: ListTile(
title: Text(listproduct![index].name.toString()),
subtitle: Text('${listproduct![index].price} تومان'),
leading:
Image.network(listproduct![index].images!.join(', ')),
),
);
},
);
} else if (snapshot.hasError) {
return Text('${snapshot.error}');
} else {
return const Center(child: CircularProgressIndicator());
}
},
),
);
}
}
