didChangeDependencies method

  1. @override
void didChangeDependencies()
override

Called when a dependency of this State object changes.

For example, if the previous call to build referenced an InheritedWidget that later changed, the framework would call this method to notify this object about the change.

This method is also called immediately after initState. It is safe to call BuildContext.dependOnInheritedWidgetOfExactType from this method.

Subclasses rarely override this method because the framework always calls build after a dependency changes. Some subclasses do override this method because they need to do some expensive work (e.g., network fetches) when their dependencies change, and that work would be too expensive to do for every build.

Implementation

@override
void didChangeDependencies() {
  super.didChangeDependencies();
  // Pinning is chrome GEOMETRY: it hoists the registered bar out of the
  // route into the shell so it survives the transition. It costs no shader
  // of its own, and the pinned bar still renders through the normal glass
  // path — GlassNavPinnedHost resolves its own quality — so at `minimal` it
  // is simply a BackdropFilter-only bar that stays put across routes, which
  // is the correct degraded behaviour rather than a reason to switch the
  // feature off.
  //
  // This used to mirror the modal sheet morph's gate
  // (`quality != GlassQuality.minimal`). That borrowed the blur's
  // capability floor for something that does not depend on it: the sheet
  // morph asks whether real glass can be drawn, and pinning never needed an
  // answer to that.
  //
  // It also meant an adaptive decision about blur cost silently changed an
  // unrelated layout behaviour. `minimal` is not only a developer opt-in —
  // GlassQualityAdapter steps down to it on its own when frame times
  // regress, which a debug build reaches routinely just by being a debug
  // build — so pinning switched itself off during ordinary local
  // development, and on any app deliberately shipping `minimal` for low-end
  // devices, which are exactly the devices where a per-route bar rebuild is
  // most visible.
  final supported = debugPinningSupported ?? true;
  if (supported != _pinningSupported) {
    _pinningSupported = supported;
  }
}