onPageExit property
An action to run when the user wants to exit the page. This is typically where you would set Navigator.pop() to go back to the previous screen, or add code to save any data that's been modified on the page.
Implementation
final VoidCallback onPageExit;