下面的示例将读取用户的密码,但也会以纯文本形式回显,有没有办法解决这个问题?
Future<String> promptPassword() {
var completer = new Completer<String>();
var stream = new StringInputStream(stdin);
stdout.writeString("Warning: Password will be displayed here until I find a better way to do this.\n");
stdout.writeString("Watch your back...\n");
stdout.writeString("GitHub password for $gituser: ");
stream.onLine = () {
var str = stream.readLine();
stdin.close();
completer.complete(str);
};
return completer.future;
}