of method Null safety

PageStorageBucket? of(
  1. BuildContext context
)

The bucket from the closest instance of this class 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).

Implementation

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