escape static method

String escape(
  1. String text
)

Implementation

static String escape(String text) {
  var text1 = text.replaceAll('\n', '\\\\n');
  text1 = text1.replaceAll(r'\', r'\\');
  text1 = text1.replaceAll(r'"', r'\"');
  text1 = text1.replaceAll('\r', '\\\\r');
  text1 = text1.replaceAll('\t', '\\\\t');
  text1 = text1.replaceAll('\b', '\\\\f');
  return text1;
}