findAncestorStateOfType<T extends State<StatefulWidget> > method
The state of the nearest stateful ancestor whose state is a T.
Implementation
@override
T? findAncestorStateOfType<T extends State<StatefulWidget>>() {
for (var a = _parent; a != null; a = a._parent) {
if (a is StatefulElement && a.state is T) {
return a.state as T;
}
}
return null;
}