Reimplement TabBarSelectionState.of() using new methods

This commit is contained in:
Ian Hickson
2016-01-07 22:09:36 -08:00
parent 51d066473f
commit 892cc272a6

View File

@@ -409,15 +409,7 @@ class TabBarSelection<T> extends StatefulComponent {
TabBarSelectionState createState() => new TabBarSelectionState<T>();
static TabBarSelectionState of(BuildContext context) {
TabBarSelectionState result = null;
context.visitAncestorElements((ancestor) {
if (ancestor is StatefulComponentElement && ancestor.state is TabBarSelectionState) {
result = ancestor.state;
return false;
}
return true;
});
return result;
return context.ancestorStateOfType(const TypeMatcher<TabBarSelectionState>());
}
}