How to replace spaces middle of string in Dart?
Using RegExp like
String result = _myText.replaceAll(RegExp(' +'), ' ');
In my case I had tabs, spaces and carriage returns mixed in (i thought it was just spaces to start)
You can use:
String result = _myText.replaceAll(RegExp('\\s+'), ' ');
If you want to replace all extra whitespace with just a single space.