of static method

Returns the nearest DialogStackState above context.

Throws if no DialogStack is found in the tree.

Implementation

static DialogStackState of(BuildContext context) {
  final state = context
      .dependOnInheritedWidgetOfExactType<_DialogStackScope>()
      ?.state;
  assert(state != null, 'No DialogStack found in the widget tree');
  return state!;
}