问题
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