firstRenderObject<T extends RenderObject> method

T firstRenderObject<T extends RenderObject>(
  1. FinderBase<Element> finder

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

Throws a StateError if finder is empty.

  • Use renderObject if you only expect to match one render object.


T firstRenderObject<T extends RenderObject>(finders.FinderBase<Element> finder) {
  return finder.evaluate().first.renderObject! as T;