颤抖如何以编程方式退出应用 [英] Flutter how to programmatically exit the app
本文介绍了颤抖如何以编程方式退出应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以编程方式关闭Flutter应用程序。
我尝试弹出唯一的屏幕,但是会导致黑屏。
How can I programmatically close a Flutter application. I've tried popping the only screen but that results in a black screen.
推荐答案
对于iOS
SystemNavigator.pop()
:不起作用
退出(0)
:可以,但是Apple可能暂停您的应用,因为以编程方式退出该应用程序违反了Apple人机交互准则。
exit(0)
: Works but Apple may SUSPEND YOUR APP because it's against Apple Human Interface guidelines to exit the app programmatically.
SystemNavigator.pop()
:有效,并且是退出应用程序的推荐方式。
退出(0)
:也可以,但是不推荐,因为它会立即终止Dart VM进程,并且用户可能会认为该应用程序刚刚崩溃。
exit(0)
: Also works but it's NOT RECOMMENDED as it terminates the Dart VM process immediately and user may think that the app just got crashed.
这篇关于颤抖如何以编程方式退出应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文