大佬教程收集整理的这篇文章主要介绍了如何在同一个类中导入dart:html&dart:io?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我注释掉#import(‘dart:io’);我错了,我得到一个编译错误,但它启动,直到我按下按钮,我是否收到运行时错误:
……这是预期的.
所以我的问题是:如何导入dart:html&飞镖:io在同一个班级?
#import('dart:html'); #import('dart:io'); class htmlIO { ButtonElement _aButton; htmlIO() { } void handlePress(Event E) { var connection = new httpClient().get('www.google.com','/'); write('made it'); } void run() { _aButton = document.query("#aButton"); _aButton.on.click.add(handlePress); write("Hello World!"); } void write(String messagE) { // the HTML library defines a global "document" variable document.query('#status').innerHTML = message; } } void main() { new htmlIO().run(); }
可能是时候你可以在服务器上使用dart:html,使用“模拟”浏览器,这可能对单元测试等有用,但你还不能这样做.
以上是大佬教程为你收集整理的如何在同一个类中导入dart:html&dart:io?全部内容,希望文章能够帮你解决如何在同一个类中导入dart:html&dart:io?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。