My flutter app has a series of pages which collect data (a series of forms). Every time the user enters data and goes to the next screen, the data is stored in my remote database. The user should have the ability to go back and change the data he entered. This means that every time the user navigates to a previous screen, the state of the screen needs to be retrieved. How can I architect this solution using Bloc (I am using the flutter_bloc package) ?
Here are some options I thought of
- Use a single Bloc for all these pages and pass around the bloc to all these pages : If I use this approach, there should be a way I can retrieve the current state of the previous page when the user clicks the back button to re visit that page. I am not sure how this is done though.
- Use hydrated bloc package - If I use this package, the state of each screen is persisted locally, so I can have a bloc per screen and retrieve the state of the screen if the user navigates back.
- Use a bloc per screen : In this case, without persistence, I am not sure how I can retrieve the current state of a page when the user navigates back ?
Are there any other solutions through which I can achieve this (preferably using bloc) ?
Thanks in advance !