Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - Do not restart application when restoring

Friends,

does anyone know how to prevent the application from restarting when restoring it? For example, the application is minimized, then restored and it restarts, any way to avoid it?

like image 203
Smith Developer Avatar asked Oct 23 '25 18:10

Smith Developer


1 Answers

This is platform dependent, per example in android it depends on the ram available, if the device needs to free resources it will kill your app , if you add some native code to handle this you could do some things to prevent android from doing this. However. It's NOT recommended to do this. If the user exits an app, it wants that, to close the app. If the user presses the home button, it wants to go to another app, and android will keep your app running for some time in case your user comes back to the app.

The best way to do this, is to handle the default flutter lifecycle to store important data in case the system kills the app.

like image 71
ValdaXD Avatar answered Oct 26 '25 07:10

ValdaXD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!