of static method

Obtain the nearest ErrorBoundaryState from the given context.

Implementation

static ErrorBoundaryState of(BuildContext context) {
  final state = context.findAncestorStateOfType<ErrorBoundaryState>();
  assert(
    state != null,
    'ErrorBoundary.of(context) called with no ErrorBoundary ancestor.',
  );
  return state!;
}