of static method

LayoutScopeInherited? of(
  1. BuildContext context, {
  2. bool listen = true,
})

The data from the closest instance of this class that encloses the given context.

Notice, that ResponsiveBuilders create new instance of LayoutScope above them if they cannot find closest instance in the widget tree

Implementation

static LayoutScopeInherited? of(BuildContext context, {bool listen = true}) {
  if (listen) {
    final widget =
        context.dependOnInheritedWidgetOfExactType<_LayoutScopeInherited>();
    return widget;
  } else {
    final element = context
        .getElementForInheritedWidgetOfExactType<_LayoutScopeInherited>();
    return element?.widget as _LayoutScopeInherited?;
  }
}