AppLifecycleListener constructor

AppLifecycleListener({
  1. WidgetsBinding? binding,
  2. VoidCallback? onResume,
  3. VoidCallback? onInactive,
  4. VoidCallback? onHide,
  5. VoidCallback? onShow,
  6. VoidCallback? onPause,
  7. VoidCallback? onRestart,
  8. VoidCallback? onDetach,
  9. AppExitRequestCallback? onExitRequested,
  10. ValueChanged<AppLifecycleState>? onStateChange,
})

Creates an AppLifecycleListener.

Implementation

AppLifecycleListener({
  WidgetsBinding? binding,
  this.onResume,
  this.onInactive,
  this.onHide,
  this.onShow,
  this.onPause,
  this.onRestart,
  this.onDetach,
  this.onExitRequested,
  this.onStateChange,
}) : binding = binding ?? WidgetsBinding.instance,
     _lifecycleState = (binding ?? WidgetsBinding.instance).lifecycleState {
  assert(debugMaybeDispatchCreated('widgets', 'AppLifecycleListener', this));
  this.binding.addObserver(this);
}