Hello,
From the main screen of my app, pressing a button switches to another screen.
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return screen2();
},
),
);
},
When I am in screen2 and I want to go back or I can press a button.
Navigator.pop(context);
or press the android back button.
How can I call a function as soon as I go back to the main screen?
Thank you.