Listening to lifecycle events

In UIKit, you can override methods to the ViewController
to capture lifecycle methods for the view itself,
or register lifecycle callbacks in the AppDelegate.
In Flutter, you have neither concept, but you can instead
listen to 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 only works on iOS,
as there is no equivalent event on Android.

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.
The iOS platform has no equivalent event.

For more details on the meaning of these states, see
AppLifecycleState documentation.

Layouts