debugIsHidingAncestorRenderObjectOfType<T extends RenderObject> static method

bool debugIsHidingAncestorRenderObjectOfType<T extends RenderObject>(
  1. BuildContext context
)

Returns true if a LookupBoundary is hiding the nearest RenderObjectWidget with a RenderObject of the specified type T from the provided BuildContext.

This method throws when asserts are disabled.

Implementation

static bool debugIsHidingAncestorRenderObjectOfType<T extends RenderObject>(BuildContext context) {
  bool? result;
  assert(() {
    bool hiddenByBoundary = false;
    bool ancestorFound = false;
    context.visitAncestorElements((Element ancestor) {
      if (ancestor is RenderObjectElement && ancestor.renderObject is T) {
        ancestorFound = true;
        return false;
      }
      hiddenByBoundary = hiddenByBoundary || ancestor.widget.runtimeType == LookupBoundary;
      return true;
    });
    result = ancestorFound & hiddenByBoundary;
    return true;
  } ());
  return result!;
}