Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query current Flutter AppLifecycleState

Tags:

flutter

dart

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.

like image 827
Ryan R Avatar asked Dec 22 '25 04:12

Ryan R


1 Answers

A little bit late, but as this was the first result on Google when I was querying the same thing, here's the answer:

WidgetsBinding.instance.lifecycleState
like image 92
Leonardo Avatar answered Dec 23 '25 18:12

Leonardo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!