maybeOf static method

PageStorageBucket? maybeOf(
  1. BuildContext context
)

The PageStorageBucket from the closest instance of a PageStorage widget that encloses the given context.

Returns null if none exists.

Typical usage is as follows:

PageStorageBucket? bucket = PageStorage.of(context);

This method can be expensive (it walks the element tree).

See also:

Implementation

static PageStorageBucket? maybeOf(BuildContext context) {
  final PageStorage? widget = context.findAncestorWidgetOfExactType<PageStorage>();
  return widget?.bucket;
}