Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

flutter

dart

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?

like image 375
Rajeshwar Avatar asked Jun 18 '18 02:06

Rajeshwar


2 Answers

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.

like image 101
Günter Zöchbauer Avatar answered Oct 24 '22 07:10

Günter Zöchbauer


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

I've searched for a web crawler/scraper 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 platform as explained:

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_html for any scraping/crawling purpose

like image 4
Constantin N. Avatar answered Oct 24 '22 07:10

Constantin N.