The possibility of your process dying at any moment is a fact of life on the Android platform and there is no way around it. Toggling wallpapers or dark/light theme is hardly the only situation in which the process will be restarted. Unfortunately you must do the work of saving and restoring user interface state yourself, and this is a very common cause of bugs for poorly architected native apps as well.<p>I'm not very familiar with Flutter development, but it appears there is some library support to handle this gracefully [1]. Good luck.<p>[1] <a href="https://docs.flutter.dev/platform-integration/android/restore-state-android" rel="nofollow">https://docs.flutter.dev/platform-integration/android/restor...</a>