dependOnInheritedWidget method

  1. @override
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

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