whereElementProp<T> method
Creates a filter for the elements of the discovered widgets based on a specified property. The filter is applied when the WidgetSelector is snapshotted.
Example usage:
spotSingle<Checkbox>()
.whereElementProp<bool>(
prop: elementProp('isFocused', (element) => element.isFocused),
match: (isFocused) => isFocused == true,
).existsOnce();
Implementation
@useResult
WidgetSelector<W> whereElementProp<T>(
NamedElementProp<T> prop,
bool Function(T value) match,
) {
return self!.addStage(
PredicateFilter(
predicate: (Element element) {
final value = prop.get(element);
return match(value);
},
description: prop.name,
),
);
}