widget<T extends Widget> method
- FinderBase<
Element> finder
The matching widget in the widget tree.
Throws a StateError if finder
is empty or matches more than
one widget.
- Use firstWidget if you expect to match several widgets but only want the first.
- Use widgetList if you expect to match several widgets and want all of them.
Implementation
T widget<T extends Widget>(finders.FinderBase<Element> finder) {
TestAsyncUtils.guardSync();
return finder.evaluate().single.widget as T;
}