How do I listen to application lifecycle events?
In Xamarin.Forms, you have an
Application that contains
OnSleep. In Flutter you can instead listen to similar lifecycle events by hooking into the
WidgetsBinding observer and listening to the
didChangeAppLifecycleState() change event.
The observable lifecycle events are:
- The application is in an inactive state and is not receiving user input. This event is iOS only.
- The application is not currently visible to the user, is not responding to user input, but is running in the background.
- The application is visible and responding to user input.
- The application is suspended momentarily. This event is Android only.
For more details on the meaning of these states, see the