dependOnInheritedWidget method

bool dependOnInheritedWidget(
  1. BuildContext? context
)
inherited

Link a widget to the InheritedWidget

Implementation

bool dependOnInheritedWidget(BuildContext? context) {
  var inherit = context != null;
  if (inherit) {
    final InheritedStateX? state =
        context.findAncestorStateOfType<InheritedStateX>();
    inherit = state != null;
    if (inherit) {
      final element = state.inheritedElement(context);
      inherit = element != null;
      if (inherit) {
        context.dependOnInheritedElement(element);
      }
    }
  }
  return inherit;
}