escapeDartString function
Escapes value for use inside a Dart double-quoted string literal.
Implementation
String escapeDartString(String value) {
return value
.replaceAll('\\', r'\\')
.replaceAll('"', r'\"')
.replaceAll('\n', r'\n')
.replaceAll('\r', r'\r')
.replaceAll('\$', r'\$');
}