firstState<T extends State<StatefulWidget>> method

T firstState <T extends State<StatefulWidget>>(Finder finder)

The first matching state according to a depth-first pre-order traversal of the widget tree.

Throws a StateError if finder is empty or if the first matching widget has no state.

  • Use state if you only expect to match one state.

Implementation

T firstState<T extends State>(Finder finder) {
  TestAsyncUtils.guardSync();
  return _stateOf<T>(finder.evaluate().first, finder);
}