I'm writing some code for Flutter Desktop targeting linux_x64.
I'm extracting some logs from some applications, these logs presents a syntax like this:
Inspecting log file using
less logfileESC(BESC[mauthentication-msESC(BESC[mInspecting log file using
less -r logfileI can see colored text into my terminal.Inspecting log file using
cat logfileI can see colored text into my terminal.Inspecting log file using
cat -vte logfileI get this:^[(B^[[mauthentication-ms^[(B^[[m$In Flutter using this code
Future<String> readAsString = file.readAsString(); readAsString.then((String value) => _log = utf8.decode(value.runes.toList()));I get this output in a SelectableText widget
(B[mauthentication-ms(B[m
I'm really confused about this behaviour so if someone has experience on this suggestions are welcome!
There are 2 options:
- Cleaning all the logs, visualizing normal text
- Trying to decode the text just as
less -rdoes, visualizing colored text into Flutter application.
EDIT:
I solved importing tint plugin: tint: ^2.0.0
and changing the Dart code (using the strip() method from tint plugin) as follows:
Future<String> readAsString = file.readAsString();
readAsString.then((String value) => _log = value.strip());