escapeRegExp function

dynamic escapeRegExp(
  1. String string
)

Implementation

escapeRegExp(String string) {
  return string.isNotEmpty && reHasRegExpChar.hasMatch(string)
      ? string.replaceAll(reRegExpChar, '\\\$&')
      : string;
}