In this recipe, you will see how to leverage Futures using Navigator to transform a Route into an async function: you will push a new screen in the app and then await the route to return some data and update the original screen.
The steps we will follow are these:
- Adding anĀ ElevatedButton that will launch the second screen.
- On the second screen, we will make the user choose a color.
- Once the color is chosen, the second screen will update the background color on the first screen.
Here, you can see a screenshot of the first screen:
And here, the second screen, which allows choosing a color with three ElevatedButtons: