of method

ScrollableState of (
  1. BuildContext context
)

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

Typical usage is as follows:

ScrollableState scrollable = Scrollable.of(context);

Calling this method will create a dependency on the closest Scrollable in the context, if there is one.

Implementation

static ScrollableState of(BuildContext context) {
  final _ScrollableScope widget = context.dependOnInheritedWidgetOfExactType<_ScrollableScope>();
  return widget?.scrollable;
}