handleAppLifecycleStateChanged method

  1. @override
void handleAppLifecycleStateChanged(
  1. AppLifecycleState state
)
override

Called when the application lifecycle state changes.

Notifies all the observers using WidgetsBindingObserver.didChangeAppLifecycleState.

This method exposes notifications from SystemChannels.lifecycle.

Implementation

@override
void handleAppLifecycleStateChanged(AppLifecycleState state) {
  super.handleAppLifecycleStateChanged(state);
  for (final observer in List<WidgetsBindingObserver>.of(_observers)) {
    try {
      observer.didChangeAppLifecycleState(state);
    } catch (exception, stack) {
      FlutterError.reportError(
        FlutterErrorDetails(
          exception: exception,
          stack: stack,
          library: 'widgets library',
          context: ErrorDescription(
            'while dispatching notifications for WidgetsBindingObserver.didChangeAppLifecycleState',
          ),
        ),
      );
    }
  }
}