escapeSpecialCharacters function
Implementation
String escapeSpecialCharacters(String input, {bool extraEscape = false}) {
return input.replaceAllMapped(RegExp(r'[-[\]()*+?.,\\^$|#\s]'),
(Match match) {
return extraEscape ? '\\\\${match[0]}' : '\\${match[0]}';
});
}