All states currently in the widget tree (lazy pre-order traversal).
The returned iterable is lazy. It does not walk the entire widget tree immediately, but rather a chunk at a time as the iteration progresses using Iterator.moveNext.
Source
Iterable<State> get allStates {
TestAsyncUtils.guardSync();
return allElements
.where((Element element) => element is StatefulElement)
.map((StatefulElement element) => element.state); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27827
}