I use LineSplitter
as a command line interface where every line is a command:
import "dart:io";
import 'dart:convert';
void main() {
var sub;
sub = stdin.transform(UTF8.decoder).transform(new LineSplitter()).listen((l) {
if (l == "e") {
sub.cancel();
}
print('$l');
});
}
Typing an e
and a line break should exit the application as the subscribtion is canceled. But this doesn't happen, instead I have to put another line break into stdin. The problem seems to be the LineSplitter
, maybe it's waiting for the next complete line, is there a way to "undo"/"unchain" the transformer so that the application exits?
Calling exit
is not an option for me as it exits immediately without correct cleanup.
I think this question is related, but isn't solved.