当您在使用项目类型创建项目时尝试运行hello world默认代码时出现以下错误:Dart Chrome App
[错误]无法读取'package:chrome / chrome_app.dart'(ChromeService错误:无法解析参考:package:chrome / chrome_app.dart
代码如下:
import 'dart:html';
import 'package:chrome/chrome_app.dart' as chrome;
int boundsChange = 100;
int count = 0;
void main() {
querySelector('#text_id').onClick.listen(resizeWindow);
}
void resizeWindow(MouseEvent event) {
chrome.ContentBounds bounds = chrome.app.window.current().getBounds();
bounds.width += boundsChange;
bounds.left -= boundsChange ~/ 2;
chrome.app.window.current().setBounds(bounds);
boundsChange *= -1;
querySelector("#count").text = (count++).toString();
}