back to previous screen flutter code example
Example: flutter how to get call back from current page to previous page
Future<void> _goToPage2() async {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Page2(),
),
);
print("Page2 is poped");
}