Finder byElementPredicate(ElementPredicate predicate, { String description, bool skipOffstage: true })

Finds widgets using an element predicate.

Example:

expect(tester, hasWidget(find.byElementPredicate(
  // finds elements of type SingleChildRenderObjectElement, including
  // those that are actually subclasses of that type.
  // (contrast with byElementType, which only returns exact matches)
  (Element element) => element is SingleChildRenderObjectElement,
  description: '$SingleChildRenderObjectElement element',
)));

If description is provided, then this uses it as the description of the Finder and appears, for example, in the error message when the finder fails to locate the desired widget. Otherwise, the description prints the signature of the predicate function.

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

Source

Finder byElementPredicate(ElementPredicate predicate, { String description, bool skipOffstage: true }) {
  return new _ElementPredicateFinder(predicate, description: description, skipOffstage: skipOffstage);
}