maybeOf static method

TwoDimensionalScrollableState? maybeOf(
  1. BuildContext context
)

The state from the closest instance of this class that encloses the given context, or null if none is found.

Typical usage is as follows:

TwoDimensionalScrollableState? scrollable = TwoDimensionalScrollable.maybeOf(context);

Calling this method will create a dependency on the closest TwoDimensionalScrollable in the context. The internal Scrollables can be accessed through TwoDimensionalScrollableState.verticalScrollable and TwoDimensionalScrollableState.horizontalScrollable.

Alternatively, Scrollable.maybeOf can be used by providing the desired Axis to the axis parameter.

See also:

Implementation

static TwoDimensionalScrollableState? maybeOf(BuildContext context) {
  final _TwoDimensionalScrollableScope? widget = context.dependOnInheritedWidgetOfExactType<_TwoDimensionalScrollableScope>();
  return widget?.twoDimensionalScrollable;
}