findAncestorWidgetOfExactType<T extends Widget> method
The widget of the nearest ancestor whose widget is exactly a T.
Implementation
@override
T? findAncestorWidgetOfExactType<T extends Widget>() {
for (var a = _parent; a != null; a = a._parent) {
final widget = a.widget;
if (widget.runtimeType == T) {
return widget as T;
}
}
return null;
}