sanitizeTerminalText function

String sanitizeTerminalText(
  1. Object? text
)

Strips ANSI escape sequences and control characters to prevent UI spoofing.

Implementation

String sanitizeTerminalText(Object? text) {
  return text.toString().replaceAll(_ansiCsi, '').replaceAll(_controlChars, '');
}