valid method

bool valid()

Whether the ansi string contains unallowed, cursor manipulating sequences.

Implementation

bool valid() =>
    !RegExp(r'\x1B$$[0-9;]*[^m]').hasMatch(text) &&
    !text.contains("\n") &&
    !text.contains("\r");