Easy state restoration with Flutter
summary
State restoration prevents losing progress when the OS kills the app by saving small instance state to the restoration bucket; the demo app “Japan Nana” survives a memory kill (caused by a game that loads 3 million JSON objects) and restores spot-after-review. Implementation uses restorable types and RestorationMixin, replaces pushNamed with restorable push / restorePushNamed, integrates with go_router and workarounds for hooks by wrapping widgets and saving a restorable enum; watch for the 1 MB Android limit and use Android’s “Don’t keep activities” to test.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:10State loss in Flutter apps
- 2:32Why state restoration matters
- 3:59State types and persistence
- 5:26Flutter’s restoration manager
- 7:14Limitations and best practices
- 8:38Setting up restoration scope
- 9:41Restoring navigation state
- 10:02Restoration mixin for widgets
- 11:27Hooks and restoration challenges
- 12:53Fixing navigation parameter issues
- 13:57Restoration scope for hooks
- 14:39Testing restoration tips
- 15:45Testing on Android and iOS
- 16:06Testing in widget and integration tests
- 16:49Live demo of restoration
- 17:10Summary
related talks
36mManaging Data Restoration with the Architecture Components
44mState Management in Flutter
19mA humble approach to Flutter app architecture
40mHow to manage application states using inherited widgets
45mArchitectural Thinking on Flutter State Management
44mState in Jetpack Compose
40mNo Worries! Handling Don’t keep activities in the Compose era
20mHow to Build the Fastest Apps: Break the Rules
