dependOnInheritedSeedOfExactType<T extends Object> method

  1. @override
T? dependOnInheritedSeedOfExactType<T extends Object>({
  1. Object? aspect,
})

Returns the nearest ancestor value provided via InheritedSeed<T> of exact type T, registering the bound branch as a dependent; null when no such ancestor exists.

Pass aspect to scope the dependency to one aspect of an InheritedModelSeed<T, A> provider; omitting it depends on the whole value. A non-null aspect against a plain InheritedSeed provider throws ArgumentError.

Throws StateError after the bound branch unmounts.

Implementation

@override
T? dependOnInheritedSeedOfExactType<T extends Object>({Object? aspect}) {
  _checkMounted('dependOnInheritedSeedOfExactType');
  if (aspect != null) {
    throw ArgumentError.value(
      aspect,
      'aspect',
      'FakeTreeContext provides plain values, not InheritedModelSeed '
          'aspects — like a plain InheritedSeed<$T> provider, which genesis '
          'rejects an aspect against. Depend without an aspect.',
    );
  }
  return _values[T] as T?;
}