byComponentPredicate method
Finds components using a component predicate
.
Sample code
expect(find.byComponentPredicate(
(Component component) => component is DomComponent && component.classes.contains('alert'),
description: 'component with "alert" class',
), findsOneComponent);
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 component. Otherwise, the description prints the
signature of the predicate function.
Implementation
Finder byComponentPredicate(ComponentPredicate predicate, {String? description}) {
return _ComponentPredicateFinder(predicate, description: description);
}