findAncestorElementOfExactType<T extends InheritedWidget> method
Returns the nearest InheritedElement of type T.
Implementation
InheritedElement?
findAncestorElementOfExactType<T extends InheritedWidget>() {
Element? current = _parent;
while (current != null) {
if (current.widget is T && current is InheritedElement) {
return current;
}
current = current._parent;
}
return null;
}