I am new flutter , developing an application which call an api and fetching data from server which is showing on a bottom sheet. in this case Iam showing the bottom sheet meanwhile perfroming the api call. After the api call I want to update the content of the bottom sheet. I have used a data object to show the content in the bottom sheet. the setstate is not updating the already showed bottomsheet. How can I update the bottom sheet content after the api call.
My APi call
model.getSpotDetails(model.spotList[position], position).then((value) =>
{
if(value){
}
});
My Bottom sheet code
showModalBottomSheet<void>(
context: context,
elevation: 5,
backgroundColor: AppTheme.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(20)),
),
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context,setState){
return Container(
height: 370,
child: bottomContent(data),
);
},
);
},
);
use future builder and then update your bottom sheet