I want to pass values from 2nd page to 1st page with navigator.pop and refresh or reload my 1st page with new values in initstate
or any other work around?
I am able to get these values in 1st page but not able to refresh or reload the page with new values in initstate
where i want to pass new data in API n get response...
any help?
I am redirecting to list page from this...
getBrand(BuildContext context) async {
tempBrand = await Navigator.push(context,
MaterialPageRoute(builder: (context) => BrandList(widget.subCatID)));
selectedBrand = tempBrand.name;
selectedBrandID = tempBrand.id;
}
now here i am passing those values in navigator.pop
Getting value here and passing back to 1st page.
Container(
padding: EdgeInsets.all(10),
child: ListView.separated(
separatorBuilder: (context, index) =>
Divider(color: Color(0xffcccccc)),
itemCount: prodBrands.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
child: InkWell(
onTap: () {
tempProdBrand = ProdBrandListModel.Message(
id: prodBrands[index].id,
name: prodBrands[index].name,
);
Navigator.pop(context, tempProdBrand);
},
child: Container(
child: Text(prodBrands[index].name),
padding: EdgeInsets.all(10.0),
),
),
);
}),
)
Want to use new values here...
submitProduct() {
api
.newbiz(
selectedBrandID,
)
.then((response) {
setState(() {
productID = response.message;
});
});
setState(() {});
}
Simply want to refresh my page from initstate or any other way when i pop back to 1st page with my new values passed in pop function.