hasEffectiveMaxLinesWhere method
A WidgetMatcher for Text widgets that performs specific assertions by
applying a custom matcher function to the maxLines
property.
Example:
spot<Text>().withText('foo').existsOnce()
.hasEffectiveMaxLinesWhere((it) => it.isNotNull().isGreaterThan(1));
See also:
- hasEffectiveMaxLines, for matching Text widgets by performing a
singular assertion against a fixed
maxLines
value.
Implementation
WidgetMatcher<Text> hasEffectiveMaxLinesWhere(MatchProp<int> match) {
return hasProp(
elementSelector: (subject) => subject.context.nest<int?>(
() => ['has "maxLines"'],
(Element element) => Extracted.value(_extractMaxLines(element)),
),
match: match.hideNullability(),
);
}