escape static method
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;
}