title: convert an existing string to a raw string in Dart
body: <p>I get FormatException when decoding the string from an HTTP response. It's because of the \n character in the string.
  It works when I convert the string a raw string.</p>
  
  <p>It's easy to declare a raw string</p>
  
  <pre><code>String raw = r'Hello \n World';
  </code></pre>
  
  <p>But how can I convert an existing string to a raw string?</p>
  
  <pre><code>String notRaw = 'Hello \n World';
  
  String raw = r'${notRaw}';
  </code></pre>
  
  <p>the above statement doesn't work as everything is after r' is treated as raw String.</p>
  
  <p>I'm having two questions</p>
  
  <p>1) How to avoid the \n issue when decoding JSON.
  2) How to convert an existing string variable to a raw string.</p>
  
  <pre><code>import 'dart:convert';
  
  void main() {
  
        var jsonRes = """
      {
              "response-list": {
                  "response": [
                      {
                          "attribute": {
                              "@name": "Problem",
                              "@isEditable": false,
                              "@value": "Services fail to respond; for example:\n\n1) unable to connect.\n2) Slow response on the console.\n3)no response."
                          }
                      }
                  ]
              }
          }
          """;
  var jsonStr = json.decode(jsonRes);
  print (jsonRes);
  }
  </code></pre>
  
  <p>Converting to Raw String</p>
  
  <pre><code>import 'dart:convert';
  
  void main() {
  
        var jsonRes = r"""
      {
              "response-list": {
                  "response": [
                      {
                          "attribute": {
                              "@name": "Problem",
                              "@isEditable": false,
                              "@value": "Services fail to respond; for example:\n\n1) unable to connect.\n2) Slow response on the console.\n3)no response."
                          }
                      }
                  ]
              }
          }
          """;
  var jsonStr = json.decode(jsonRes);
  print (jsonRes);
  }
  </code></pre>