ancestorInheritedElementForWidgetOfExactType method

  1. @Deprecated('Use getElementForInheritedWidgetOfExactType instead. ' 'This feature was deprecated after v1.12.1.')
  2. @override
InheritedElement ancestorInheritedElementForWidgetOfExactType (
  1. Type targetType
)
@Deprecated('Use getElementForInheritedWidgetOfExactType instead. ' 'This feature was deprecated after v1.12.1.'), inherited

Obtains the element corresponding to the nearest widget of the given type, which must be the type of a concrete InheritedWidget subclass.

This method is deprecated. Please use getElementForInheritedWidgetOfExactType instead.

Implementation

@Deprecated(
  'Use getElementForInheritedWidgetOfExactType instead. '
  'This feature was deprecated after v1.12.1.'
)
@override
InheritedElement ancestorInheritedElementForWidgetOfExactType(Type targetType) {
  assert(_debugCheckStateIsActiveForAncestorLookup());
  final InheritedElement ancestor = _inheritedWidgets == null ? null : _inheritedWidgets[targetType];
  return ancestor;
}