withEffectiveTextStyle method
A WidgetSelector for Text widgets widgets that have a fixed TextStyle value.
Example:
final style = TextStyle(
fontSize: 20,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
letterSpacing: 2,
);
spot<Text>().withText('foo').withEffectiveTextStyle(style).existsOnce();
See also:
- withEffectiveTextStyleMatching, for selecting Text widgets that meet specified TextStyle conditions, as defined by a custom matcher function.
Implementation
WidgetSelector<Text> withEffectiveTextStyle(TextStyle? value) {
return withEffectiveTextStyleMatching((it) {
if (value == null) {
it.isNull();
} else {
it.equals(value);
}
});
}