【发布时间】:2013-01-29 20:10:26
【问题描述】:
下面的例子会读入用户的密码,但也会以纯文本的形式回显,有没有办法解决这个问题?
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;
}
【问题讨论】:
标签: dart command-line-interface dart-io