rootAncestorStateOfType method

State<StatefulWidget> rootAncestorStateOfType (TypeMatcher matcher)

Returns the State object of the furthest ancestor StatefulWidget widget that matches the given TypeMatcher.

Functions the same way as ancestorStateOfType but keeps visiting subsequent ancestors until there are none of the type matching TypeMatcher remaining. Then returns the last one found.

This operation is O(N) as well though N is the entire widget tree rather than a subtree.

Implementation

State rootAncestorStateOfType(TypeMatcher matcher);