ancestorWidgetOfExactType method
- @Deprecated('Use findAncestorWidgetOfExactType instead. ' 'This feature was deprecated after v1.12.1.')
- @override
@Deprecated('Use findAncestorWidgetOfExactType instead. ' 'This feature was deprecated after v1.12.1.'), override
Returns the nearest ancestor widget of the given type, which must be the type of a concrete Widget subclass.
This method is deprecated. Please use findAncestorWidgetOfExactType instead.
Implementation
@Deprecated(
'Use findAncestorWidgetOfExactType instead. '
'This feature was deprecated after v1.12.1.'
)
@override
Widget ancestorWidgetOfExactType(Type targetType) {
assert(_debugCheckStateIsActiveForAncestorLookup());
Element ancestor = _parent;
while (ancestor != null && ancestor.widget.runtimeType != targetType)
ancestor = ancestor._parent;
return ancestor?.widget;
}