findAncestorRenderElementOfExactType<T extends RenderElement> method
Returns the nearest ancestor render element of the given type T
, which
must be the type of a concrete RenderElement subclass.
Implementation
@override
T? findAncestorRenderElementOfExactType<T extends RenderElement>() {
RenderElement? ancestor = _parent;
var matchType = '$T';
while (null != ancestor && '${ancestor.runtimeType}' != matchType) {
ancestor = ancestor._parent;
}
if ('${ancestor.runtimeType}' == matchType) {
return ancestor as T;
}
return null;
}