onPressed property
Optional callback function executed when the button is pressed.
This callback is executed before the navigation action. If the navigation stack can be popped, it will pop; otherwise, it navigates to the root route.
Implementation
final VoidCallback? onPressed;