'Flutter - Add color to portion of text with intl plugin for localization

I'm using the flutter plugin Intl for localize my app, everything work great, I can use variable in my strings like

//Somewere in code
 String displayname = 'toto';

 S.of(context).whyDeserveSecondChance(displayName),

Which prints the correct String in the correct language with the correct displayname.

My problem here, is that I want my displayname to appear on screen with a different color, I know that I can split my string in 3 but in some language it will just not work, so I have to keep it one string with the ${displayname}

I've search all day with no luck, does someone have a clue for me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source