我试图按照" Dart for Absolute Beginner"本书和来自dartlang https://www.dartlang.org/tutorials/dart-vm/cmdline" stdin"接受键盘输入的示例,但是dartpad将显示“未被捕获”#39;对于我尝试的每一个例子。
示例代码:
import 'dart.io'
void main() {
stdout.writeln('Type something');
String input = stdin.readLineSync();
stdout.writeln('You typed: $input');
}
有人能指出我应该添加的内容吗?尝试和捕获块?我该怎么做或达到目的?我只是在第41页的“绝对初学者的飞镖”#34;这本书不要这么做;我希望我知道的很多。
答案 0 :(得分:1)
DartPad在执行代码之前将Dart转换为JavaScript。
[WARNING] Could not validate integrity of download from gs://mavenbucket/snapshot/com/gkatzioura/storage/CloudStorageTest/1.0-SNAPSHOT/maven-metadata.xml
org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, expected 7e0c3c33db781362483c0baed3ba175352945028 but is da39a3ee5e6b4b0d3255bfef95601890afd80709
at org.eclipse.aether.connector.basic.ChecksumValidator.validateExternalChecksums (ChecksumValidator.java:174)
at org.eclipse.aether.connector.basic.ChecksumValidator.validate (ChecksumValidator.java:103)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask (BasicRepositoryConnector.java:456)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:360)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run (RunnableErrorForwarder.java:75)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute (BasicRepositoryConnector.java:583)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get (BasicRepositoryConnector.java:232)
仅限于控制台应用程序。
dart:io
提供了浏览器中可用API的抽象,但浏览器中没有dart:html
或stdin
。