of static method

Retrieves the StackPageState from the closest StackPage ancestor.

Implementation

static StackPageState of(BuildContext context) {
  final provider =
      context.dependOnInheritedWidgetOfExactType<_StackPageStateProvider>();

  assert(
    provider != null,
    "Couldn't find an StackPageState from the given context.",
  );

  return provider!.pageState;
}