firstElement<T extends Element> method

T firstElement<T extends Element>(
  1. 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.


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