using import 'dart:html' in flutter - Do I need additional dependencies?

北慕城南 提交于 2021-01-21 18:57:20

问题


I came across a websocket example that I would like to use. However it uses import 'dart:html';. When I introduce that in my Flutter project seems like its not being picked up. Do I need to add additional dependencies to the pubspec.yaml?


回答1:


dart:html can't be used in Flutter. It is for browser applications only.

dart:html also only comes with the regular Dart SDK, not with the Dart SDK shipped with Flutter.




回答2:


I know this is an old question but let me drop this answer here.

I've searching for a web crawler/scrapper for Flutter for a while now. I've tried to use FlutterWebview and also the html package but no way.Recently i've found a new package for this.

The advantage of this package is that it is really cross paltform as expalined:

Cross-platform dart:html that works in the browser, Dart VM, and Flutter.

  • Typical use cases are:

  • Cross-platform application development (e.g. Flutter mobile and web versions). Web crawling and scraping

you can use universal_htm for any scaping / crawling purpose



来源:https://stackoverflow.com/questions/50901960/using-import-darthtml-in-flutter-do-i-need-additional-dependencies

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!