简体   繁体   中英

is it possible to keep flutter app do not killed by iOS when running in background

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM