element<T extends Element> method

T element <T extends Element>(Finder finder)

The matching element in the widget tree.

Throws a StateError if finder is empty or matches more than one element.

  • Use firstElement if you expect to match several elements but only want the first.
  • Use elementList if you expect to match several elements and want all of them.

Implementation

T element<T extends Element>(Finder finder) {
  TestAsyncUtils.guardSync();
  return finder.evaluate().single;
}