My app has a long form, so I want to save its data in the case that the Android OS kills my app when it's in the background (e.g. when picking an image using image_picker). My form is implemented using flutter_form_builder. My state management solution is bloc. Routing is handled by auto_route.
After a quick search, I found the package hydrated_bloc that allows me to persist the state of a bloc and restore it when the user comes back to the forms page. My issue is that the state of the bloc is persisted always (not only when the app is killed by the OS), so when the user fills out the form and closes the view, and then comes back to the page, the bloc will restore the previous state anyways (which I don't want). I only want the state to be restored when the app has been killed previously due to Android Activity Destruction.
Also, how to make sure the user will get redirected to the correct page when the app starts again and how to fill out the data of the form (which isn't stored in the bloc state, but in the form itself which is a StatefulWidget - FormBuilder).