This is my code in which I am fetching data from an API, now the problem I am getting here is that When some of my network images are not loading then the problem is displayed on the mobile screen as shown in the image below
FutureBuilder(
future: countriesListApi(),
builder: (context,AsyncSnapshot<List<dynamic>> snapshot){
if(snapshot.hasData && snapshot.connectionState==ConnectionState.done){
return SingleChildScrollView(
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
physics: ScrollPhysics(),
itemCount:snapshot.data!.length,
itemBuilder: (context,index){
return Container(
width: MediaQuery.of(context).size.width*0.8,
height: 50,
child: Row(
children: [
Image(
image: NetworkImage(snapshot.data![index]['countryInfo']['flag']
),
width: 50,
height: 50,
),
Text(
snapshot.data![index]['country'],
)
],
),
);
},
),
);
}
else if(snapshot.connectionState==ConnectionState.waiting){
return Text('Loading....');
}
else if(snapshot.hasError){
return Text('Erorr');
}
else{
print(snapshot.error);
return Text("else returned");
}
},
),
I want that the data which is already loaded should be shown and the remaining data keeps loading in back.