escapeSingleQuoteString function
Implementation
String? escapeSingleQuoteString(String? input, bool escapeDollar) {
if (input == null) {
return null;
}
var body = input.replaceAllMapped(_singleQuoteEscape, (match) {
if (match[0] == '\$') {
return escapeDollar ? '\\\$' : '\$';
} else if (match[0] == '\n') {
return '\\n';
} else if (match[0] == '\r') {
return '\\r';
} else {
return '\\${match[0]}';
}
});
return "'$body'";
}