prefer_text_rich
Severity | Quick Fix | Options |
---|---|---|
Info | ✅ | ❌ |
Details
PREFER using Text.rich
instead of RichText
.
Using Text.rich
is more efficient than RichText
because of possible const constructor usage.
Bad
RichText(
text: const TextSpan(
text: 'Pyramid',
children: [
TextSpan(text: 'Lint'),
],
),
)
Good
const Text.rich(
TextSpan(
text: 'Pyramid',
children: [
TextSpan(text: 'Lint'),
],
),
)