didChangeDependencies method

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

Intercepts framework dependency updates to push the updated BuildContext into the reactive pipeline.

Requires:

  • Must be called by Flutter's element lifecycle during dependency changes.

Ensures:

  • Suppresses immediate framework rebuilds and delegates context updates to _intent._contextController.
  • Schedules a rebuild only if the reactive pipeline computes a modified UI subtree.

Implementation

@mustCallSuper
@override
void didChangeDependencies() {
  _suppressMarkNeedsBuild = true;
  try {
    super.didChangeDependencies();
  } finally {
    _suppressMarkNeedsBuild = false;
    // Instead of forcing a rebuild, delegate the context update to the reactive pipeline.
    // The terminal will trigger markNeedsBuild only if the resulting UI actually changes.
    _intent._contextController.set(this);
  }
}