of static method
The resolver (CommonLayout) from the closest CommonLayoutWidget instance that encloses the given
context.
Implementation
static CommonLayout of(BuildContext context) {
final resolverAncestor = context.dependOnInheritedWidgetOfExactType<LayoutResolverInheritedWidget>();
if (resolverAncestor == null) {
throw StateError('No ancestor with `LayoutResolverInheritedWidget` (of type CommonLayout)');
}
final resolver = resolverAncestor.resolver;
if (resolver is! CommonLayout) {
throw StateError(
'Found `LayoutResolverInheritedWidget` ancestor of type ${resolver.runtimeType}. Expected a `CommonLayout`.',
);
}
return resolver;
}