Do not call `exit` on Android or iOS
dnfield opened this issue · 5 comments
Calling exit
is not safe in Flutter applications. It results in unpredictable shutdown/destruction of objects and crashes.
See e.g. flutter/flutter#142835
Please consider updating your plugin to not call exit.
any update?
I'm not sure I fully understand the use case for this plugin or how to achieve it's actual goal. Whatever it's goal is, calling exit isn't safe and will cause crashes sometimes.
@dnfield My specific use case is with shorebird.dev to allow users to apply a patch. e.g. we detect a new patch is available, show an in app notification which if the user taps, it causes the app to restart applying the patch.
Given that scenario, do you know if there there a safe mechanism available to force the app's process to close? Happy to implement and open a PR.
Thanks in advance!
In the new version 1.3.0, the exit method has been removed from Android restart. It is now using a new safe strategy to handle the native restart.
Unfortunately, there is no other way for iOS instead of using the exit method. Feel free to check this comment for more clarification.