of method
Convenience method for when an InheritableAspect is already known.
Provide rebuild
(defaults to true
) if you want to control whether
context
should depend on the nearest enclosing Inheritable of T
.
Contrary to similar static of
methods, this is an instance method, since
the return value depends on the InheritableAspect implementation itself and it cannot be a generic
parameter on the InheritableAspect class. Since it would not allow using InheritableAspect<T>
in many places.
Subclasses may also provide additional configuration via named parameters. Subclasses may also use the above doc template.
The default implementation returns the nearest enclosing Inheritable of
T
satisfying this aspect or null
Implementation
Object? of(BuildContext context, {bool rebuild = true}) {
return Inheritable.of<T>(context, aspect: this, rebuild: rebuild);
}