renderObject<T extends RenderObject> method

T renderObject<T extends RenderObject>(
  1. FinderBase<Element> finder
)

The render object of the matching widget in the widget tree.

Throws a StateError if finder is empty or matches more than one widget (even if they all have the same render object).

  • Use firstRenderObject if you expect to match several render objects but only want the first.
  • Use renderObjectList if you expect to match several render objects and want all of them.

Implementation

T renderObject<T extends RenderObject>(finders.FinderBase<Element> finder) {
  TestAsyncUtils.guardSync();
  return finder.evaluate().single.renderObject! as T;
}