Home > OS >  Flutter Ios how to exit app without exit(0)?
Flutter Ios how to exit app without exit(0)?

Time:06-01

Hi im tryng to exit with button. I know that using exit(0) is not recommended. I have tried SystemChannels.platform.invokeMethod('SystemNavigator.pop'); but it didnt worked also any reccomendations ? Thanks in advance

CodePudding user response:

For iOS

SystemNavigator.pop(): Does NOT WORK

exit(0): Works but Apple may SUSPEND YOUR APP

Please see:

https://developer.apple.com/library/archive/qa/qa1561/_index.html

CodePudding user response:

if you use exit(0), then the app seems to be crashed. That is the reason Apple doesn't recommend the implementation of exit(0) explicitly.

If you want to exit with a button tap, then please add an alert to the user that why you have to restrart/exit the application. Therefore, users will be alerted why the app will misbehave with them.

  • Related