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
Asked
Active
Viewed 1,825 times
1
-
Does this answer your question? [Flutter how to programmatically exit the app](https://stackoverflow.com/questions/45109557/flutter-how-to-programmatically-exit-the-app) – zizutg Jun 01 '22 at 02:06
2 Answers
0
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

Xuuan Thuc
- 2,340
- 1
- 5
- 22
0
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.

Ankur Lahiry
- 2,253
- 1
- 15
- 25
-
hi what should I try I tried. SystemChannels.platform.invokeMethod('SystemNavigator.pop'); but it doesn't work with iOS – Yigit Kaya Jun 01 '22 at 09:35