[英]The requested built-in library is not available on Dartium - library handler failed import 'dart:io';
I am beginner in Dart. 我是Dart的初学者。 I have build a simple application in Dart.
我已经在Dart中构建了一个简单的应用程序。
import 'dart:math';
import 'dart:io';
void main() {
int guess;
Random rand = new Random();
int answer = rand.nextInt(100);
do{
print("Enter your guess number: ");
String temp = stdin.readLineSync();
guess = int.parse(temp);
if (guess < answer){
print("Too low");
}else if (guess > answer){
print("Too high");
}
}while(guess != answer);
print("Got it!");
}
But, when i run it on Dartium. 但是,当我在Dartium上运行它时。 It has an error.
它有一个错误。
What can I do to solve this? 我该怎么解决? Thanks.
谢谢。
dart:io
is for console/server applications. dart:io
用于控制台/服务器应用程序。 If you want to run the code in the browser you must not import it. 如果要在浏览器中运行代码,则不得导入。 Maybe
dart:html
is what you want instead. 也许
dart:html
才是您想要的。 It exposes the browser API. 它公开了浏览器API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.