firstState<T extends State<StatefulWidget>> method

T firstState<T extends State<StatefulWidget>>(
  1. FinderBase<Element> 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>(finders.FinderBase<Element> finder) {
  TestAsyncUtils.guardSync();
  return _stateOf<T>(finder.evaluate().first, finder);
}