safe_data property

String get safe_data

Implementation

String get safe_data {
  var escapedData = data;
  // Matches characters that need escaping: [ ] , : " ' = > ~ + * $ ^ | ! ? { } ; / ( ) ` and space
  var specialCharsRegExp = RegExp(r'([\[\],:\"\;=><~+\*\$^\|!\?{}\(\)/` ])');
  escapedData = escapedData.replaceAllMapped(
      specialCharsRegExp, (match) => '\\${match.group(0)}');
  return escapedData;
}