dependOnInheritedWidget method

bool dependOnInheritedWidget(
  1. BuildContext? context
)
inherited

Set the specified widget (through its context) as a dependent of the InheritedWidget

Return false if not configured to use the InheritedWidget

Implementation

bool dependOnInheritedWidget(BuildContext? context) {
  final depend = useInherited && context != null;
  if (depend) {
    if (_inheritedElement == null) {
      _dependencies.add(context);
    } else {
      context.dependOnInheritedElement(_inheritedElement!);
    }
  }
  return depend;
}