I'm trying to highlight any numbers & special characters like '%' from a String that comes dynamically from JSON. This is my current implementation but I can't understand how to change it dynamically.
RichText(
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
maxLines: 4,
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: 'Hey I\'m',
style: TextStyle(
color: kDarkBlue, fontSize: 21)),
TextSpan(
text: '1234 ',
style: TextStyle(
fontWeight: FontWeight.w800,
fontSize: 24)),
TextSpan(
text: 'and',
style: TextStyle(fontSize: 21)),
TextSpan(
text: '%',
style: TextStyle(
fontWeight: FontWeight.w800,
fontSize: 24)),
],
),
),