Flutter state restoration example app
This is an example app of how to implement state restoration on Flutter.
Operating systems like Android and iOS can kill the app's process when running low on resources like RAM.
The instance state can be preserved and restored using State Restoration APIs, like RestorationMixin
and restorablePush()
, for example.
For more information about, visit documentation.
- Enable "Don't keep activities" option in the developer menu on Android settings.
- Open the example app
- Tap on "With state restoration" button
- Play around with input field, checkbox, list scroll, etc...
- Go to device home screen or another app via launcher (or recent apps)
- Switch back to the example app
- You should see everything as it was before minimizing the app
- Primitive properties
- Text Field
- Navigation
- Passing arguments
- Receiving result
- List (Scroll position)
- Bottom Navigation
- Scaffold (Drawer)
- Dialog
- Comparison with native implementations (Activity's onRestoreInstanceState/ViewModel's Saved State)
Note: Currently, there is no state restoration support for Bottom Sheets (See issue #70915)