descendant method

Finder descendant(
  1. {required FinderBase<Element> of,
  2. required FinderBase<Element> matching,
  3. bool matchRoot = false,
  4. bool skipOffstage = true}
)

Finds widgets that are descendants of the of parameter and that match the matching parameter.

Sample code

expect(find.descendant(
  of: find.widgetWithText(Row, 'label_1'),
  matching: find.text('value_1'),
), findsOneWidget);

If the matchRoot argument is true then the widget(s) specified by of will be matched along with the descendants.

If the skipOffstage argument is true (the default), then nodes that are Offstage or that are from inactive Routes are skipped.

Implementation

Finder descendant({
  required FinderBase<Element> of,
  required FinderBase<Element> matching,
  bool matchRoot = false,
  bool skipOffstage = true,
}) {
  return _DescendantWidgetFinder(of, matching, matchRoot: matchRoot, skipOffstage: skipOffstage);
}