firstElement<T extends Element> method

T firstElement<T extends Element>(
  1. FinderBase<Element> 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>(finders.FinderBase<Element> finder) {
  TestAsyncUtils.guardSync();
  return finder.evaluate().first as T;
}