prefer-text-rich
Warns when a RichText
widget is used instead of Text.rich
.
RichText
does not handle text scaling very well, so if accessability is important for you, use Text.rich
instead.
Example
❌ Bad:
// LINT
RichText(
text: TextSpan(
text: 'Hello ',
children: [
TextSpan(text: 'bold'),
TextSpan(text: ' world!'),
],
),
);
✅ Good:
Text.rich(
TextSpan(
text: 'Hello ',
children: [
TextSpan(text: 'bold'),
TextSpan(text: ' world!'),
],
),
)