3. Show the selection screen with two buttons

Now, build a selection screen that contains two buttons.
When a user taps a button,
that app closes the selection screen and lets the home
screen know which button was tapped.

This step defines the UI.
The next step adds code to return data.

4. When a button is tapped, close the selection screen

Now, update the onPressed() callback for both of the buttons.
To return data to the first screen,
use the Navigator.pop() method,
which accepts an optional second argument called result.
Any result is returned to the Future in the SelectionButton.

Yep button

Nope button

5. Show a snackbar on the home screen with the selection

Now that you’re launching a selection screen and awaiting the result,
you’ll want to do something with the information that’s returned.