Search code examples
androidiosflutterspecial-charactersdollar-sign

$ sign in a Text widget , how to show special characters in flutter? how to set special character to text widget in flutter


I am trying to write a $ sign in a Text

Text("Refer and Win 10 000 $")

I get an error

enter image description here

What is the correct way to write this?


Solution

  • As @Davy M mentioned, you have to escape the $ because it's used as a control character for embedding variables in a string. See the Dart docs: https://www.dartlang.org/guides/language/language-tour#strings