of static method

Finds the DebugOverlayState from the closest instance of this class that encloses the given context.

Implementation

static DebugOverlayState of(BuildContext context) {
  final DebugOverlayState? result = maybeOf(context);
  if (result != null) {
    return result;
  }
  throw FlutterError.fromParts([
    ErrorSummary(
      "DebugOverlay.of() called with a context that does not contain a DebugOverlay.",
    ),
    context.describeElement("The context used was"),
  ]);
}