Search code examples
dartflutter

How to add dollar sign $ to strings in Dart?


I need to use this String value. However, I cannot seem use the dollar sign "$".

Text('! @ # $ & * ~', style: TextStyle(color: Colors.grey))

Solution

  • Dollar is a special character, you need to banalize them with a \

    void main(){
        String s = "! @ # \$ & * ~";
        print('$s');
    }