After installing the app from App Store or TestFlight, when the user opens the app and then force-kills it multiple times, the app sometimes gets permanently stuck on a black screen at launch.
Important Notes
This issue does NOT happen on Flutter 3.24.5 — works perfectly on all tested iOS devices.
The problem started only after migrating to Flutter 3.35.6.
This issue happens only in real production installs (App Store / TestFlight).
It does not reproduce easily in Debug mode or through Xcode run / Android Studio run.
Steps to Reproduce
Install the app from App Store or TestFlight
Launch the app
Force-kill the app using app switcher
Repeat launch + kill multiple times
After 3–7 attempts, app gets stuck on black screen on launch
It feels like the app gets stuck because some data gets corrupted or some data gets into an invalid state. I think killing the app triggers the corruption or the invalid state.
Things that comes to mind are:
Shorebird
Ephemeral state solutions like RestorationManager or hydrated_bloc
I would start logging the whole app boot process to methodically narrow down the issue.
I’ve had issues with blank screens on start-up if I have an exception in state restoration. This could be very frustrating, as killing the app would not reset the faulty state restoration, so it’d just try again and return to the blank screen.
I ended up setting up a 15-second timer in main that calls exit() if it does not receive a notification from the home screen that initState had been reached. On restart, it then uses a new restorationScopeId for MaterialApp so that the borked restoration is abandoned.
Using contents of this forum for the purposes of training proprietary AI models is forbidden. Only if your AI model is free & open source, go ahead and scrape. Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.