ancestorRenderObjectOfType method

  1. @Deprecated('Use findAncestorRenderObjectOfType instead. ' 'This feature was deprecated after v1.12.1.')
  2. @override
RenderObject ancestorRenderObjectOfType (
  1. TypeMatcher matcher
)
@Deprecated('Use findAncestorRenderObjectOfType instead. ' 'This feature was deprecated after v1.12.1.'), override

Returns the RenderObject object of the nearest ancestor RenderObjectWidget widget that matches the given TypeMatcher.

This method is deprecated. Please use findAncestorRenderObjectOfType instead.

Implementation

@Deprecated(
  'Use findAncestorRenderObjectOfType instead. '
  'This feature was deprecated after v1.12.1.'
)
@override
RenderObject ancestorRenderObjectOfType(TypeMatcher matcher) {
  assert(_debugCheckStateIsActiveForAncestorLookup());
  Element ancestor = _parent;
  while (ancestor != null) {
    if (ancestor is RenderObjectElement && matcher.check(ancestor.renderObject))
      return ancestor.renderObject;
    ancestor = ancestor._parent;
  }
  return null;
}