inhOf<T extends InheritedWidget> method

T inhOf<T extends InheritedWidget>({
  1. bool listen = true,
})

Obtain the nearest widget of the given type T, which must be the type of a concrete InheritedWidget subclass, and register this build context with that widget such that when that widget changes (or a new widget of that type is introduced, or the widget goes away), this build context is rebuilt so that it can obtain new values from that widget.

Implementation

T inhOf<T extends InheritedWidget>({bool listen = true}) =>
    inhMaybeOf<T>(listen: listen) ??
    (throw ArgumentError(
      'Out of scope, not found inherited widget '
          'a $T of the exact type',
      'out_of_scope',
    ));