replaceAll method
Replaces all matches with replacement.
Implementation
void replaceAll(String replacement) {
if (_matches.isEmpty) return;
final text = _codeController.text;
String pattern = _lastQuery;
if (!_isRegex) {
pattern = RegExp.escape(_lastQuery);
}
if (_matchWholeWord) {
pattern = '\\b$pattern\\b';
}
try {
final regExp = RegExp(pattern, caseSensitive: _caseSensitive);
final newText = text.replaceAll(regExp, replacement);
_codeController.replaceRange(0, text.length, newText);
} catch (e) {
debugPrint('FindController: Replace All failed. Error: $e');
}
}