State state(Finder finder)

The matching state in the widget tree.

Throws a StateError if finder is empty, matches more than one state, or matches a widget that has no state.

  • Use firstState if you expect to match several states but only want the first.
  • Use stateList if you expect to match several states and want all of them.

Source

State/*=T*/ state/*<T extends State>*/(Finder finder) {
  TestAsyncUtils.guardSync();
  return _stateOf/*<T>*/(finder.evaluate().single, finder);
}