maybeOf<T extends OrbitStore> static method
Returns the nearest ancestor OrbitScope<T>'s store, or null if
no such ancestor exists.
Implementation
static T? maybeOf<T extends OrbitStore>(
BuildContext context, {
bool listen = true,
}) {
if (listen) {
return context
.dependOnInheritedWidgetOfExactType<_OrbitScopeInherited<T>>()
?.store;
}
final element = context
.getElementForInheritedWidgetOfExactType<_OrbitScopeInherited<T>>();
return (element?.widget as _OrbitScopeInherited<T>?)?.store;
}