didChangeDependencies method

  1. @override
  2. @mustCallSuper
void didChangeDependencies()
inherited

This method is also called immediately after initState. Otherwise called only if this State object's Widget is a dependency of InheritedWidget. When a InheritedWidget's build() function is called the dependent widget's build() function is also called but not before their didChangeDependencies() function. Subclasses rarely use this method.

Implementation

@override
@mustCallSuper
void didChangeDependencies() {
  super.didChangeDependencies();
  // Determine if this app has been called by another app.
  final state = context.findRootAncestorStateOfType<_AppState>();

  if (state != null && !_appInApp) {
    // A flag indicating if this app is called by another app
    _appInApp = state != this;
  }
}