Home > Back-end >  is it possible to keep flutter app do not killed by iOS when running in background
is it possible to keep flutter app do not killed by iOS when running in background

Time:11-28

I was wonder if possible to keep the app always rescue from backgroud? I am use an app writed using flutter in iOS, sometimes when I switched this app to the background, when next use it, will open a fresh state and lost the last state. is it possible to make the app always could keep the last state except exit app by user. So that the app would keep all the state of the last seem by the user.

CodePudding user response:

You cannot prevent the operating system from killing your app. iOS kills apps to increase battery life and to free memory.

What you can do is to store some state to the file system with packages like shared_preferences or hive.

If you are using BLoC, you might also find the hydrated_bloc package useful.

  • Related