请求的内置库在 Dartium 上不可用 - 库处理程序导入失败 'dart:io';
The requested built-in library is not available on Dartium - library handler failed import 'dart:io';
我是 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!");
}
但是,当我 运行 它在 Dartium 上时。有错误。
我该怎么做才能解决这个问题?谢谢
dart:io
适用于 console/server 个应用程序。如果您想 运行 浏览器中的代码,则不得导入它。也许 dart:html
是您想要的。它公开了浏览器 API.
我是 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!");
}
但是,当我 运行 它在 Dartium 上时。有错误。
我该怎么做才能解决这个问题?谢谢
dart:io
适用于 console/server 个应用程序。如果您想 运行 浏览器中的代码,则不得导入它。也许 dart:html
是您想要的。它公开了浏览器 API.