firstWidget<T extends Widget> method

T firstWidget <T extends Widget>(Finder finder)

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

Throws a StateError if finder is empty.

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

Implementation

T firstWidget<T extends Widget>(Finder finder) {
  TestAsyncUtils.guardSync();
  return finder.evaluate().first.widget;
}