write method
Writes text to the output as it is: no level, no style, no line
break. While an inline session holds the screen, text goes above
what is live line by line, as each line break ends one; what is left
goes when the console is closed.
Implementation
void write(String text) {
final session = _liveSession;
final opening = _openingSession;
if (session == null && opening == null) {
terminal.out.write(text);
return;
}
_partial.write(text);
final all = _partial.toString();
final end = all.lastIndexOf('\n');
if (end < 0) {
return;
}
_partial
..clear()
..write(all.substring(end + 1));
final lines = messageLines(all.substring(0, end), const Style());
unawaited(
session != null
? session.commit(_linesWidget(lines))
: _commitWhenOpen(opening!, lines, terminal.out),
);
}