firstElement<T extends Element> method

T firstElement <T extends Element>(Finder finder)

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

Throws a StateError if finder is empty.

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

Implementation

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