observeInheritedWidget<T extends InheritedWidget> function

ValueListenable<T> observeInheritedWidget <T extends InheritedWidget>(
  1. [T orElse(
      )]
    )

    Implementation

    ValueListenable<T> observeInheritedWidget<T extends InheritedWidget>(
        [T orElse()]) {
      final target = activeObservable;
      final result = ValueNotifier<T>(
          target.context.inheritFromWidgetOfExactType(T) ?? orElse());
    
      observeLifecycle(StateLifecyclePhase.didChangeDependencies, () {
        final T widget = target.context.inheritFromWidgetOfExactType(T) ?? orElse();
        if (widget == result.value) return;
        result.value = widget;
      });
    
      return result;
    }