stripAnsi function
text with every escape sequence removed, leaving only what a reader sees.
Built on parseAnsi rather than on a second regular expression, so there is one answer to "where does this sequence end" and the stripper cannot come to disagree with the renderer about it.
Implementation
String stripAnsi(String text) {
if (!text.contains(_escString)) return text;
return parseAnsi(text).map((span) => span.text).join();
}