didChangeAppLifecycleState method

  1. @protected
  2. @override
  3. @mustCallSuper
void didChangeAppLifecycleState(
  1. AppLifecycleState state
)
override

Called when the system puts the app in the background or returns the app to the foreground.

Implementation

@protected
@override
@mustCallSuper
void didChangeAppLifecycleState(AppLifecycleState state) {
  /// Passing either the values AppLifecycleState.paused or AppLifecycleState.resumed.

  /// No 'setState()' functions are allowed to fully function at this point.
  _rebuildAllowed = false;
  for (final listener in _beforeList) {
    listener.didChangeAppLifecycleState(state);
  }
  for (final con in _controllerList) {
    con.didChangeAppLifecycleState(state);
  }
  for (final listener in _afterList) {
    listener.didChangeAppLifecycleState(state);
  }
  _rebuildAllowed = true;
  if (_rebuildRequested || _inTester) {
    _rebuildRequested = false;

    /// Perform a 'rebuild' if requested.
    refresh();
  }
}