简体   繁体   中英

Query current Flutter AppLifecycleState

I am aware that we can observe AppLifecycle state changes , but how can we query the current state?

I'd like to guard certain logic before it has observed a state change.

有点晚了,但由于这是我查询相同内容时在 Google 上的第一个结果,因此答案如下:

WidgetsBinding.instance.lifecycleState

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM