dependOnInheritedWidgetOfExactType<T extends InheritedWidget> method
Obtains the nearest inherited widget of the given type T.
Implementation
@override
T? dependOnInheritedWidgetOfExactType<T extends InheritedWidget>() {
var ancestor = parent;
while (ancestor != null) {
if (ancestor.widget is T) {
return ancestor.widget as T;
}
ancestor = ancestor.parent;
}
return null;
}