Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running dart project says dart:html is not available for the standalone vm

I used Git to pull a project I then start IntelliJ, and say: Open Project.

The project itself looks like it has 4 modules, Lab1, Lab2, Solution2, Solution2

I open the full project. In Lab1, i want to run to see how my web page looks, but when i say: Run main.dart the error kicked back is:

C:\code\dart-sdk\bin\dart.exe --ignore-unrecognized-flags --checked --enable-vm-service:51293 --trace_service_pause_events C:\code\workspace\tw_remoting_training\codelab_01\web\main.dart
Observatory listening on http://127.0.0.1:51293
The built-in library 'dart:html' is not available on the stand-alone VM.
'package:remoting_training/remoting_printer.dart': error: line 20 pos 1: library handler failed
import 'dart:html';
^

Process finished with exit code 254

Im not sure what is going on here though. As a secondary option, i will also try to Right-Click on index.html and click: Open with > Dartium but that shows a blank page. It shouldve done 4 async calls which printed strings to the screen.

Is there something I am missing? Is it not running because of it being a module in a project?

like image 319
Fallenreaper Avatar asked Jan 13 '16 17:01

Fallenreaper


1 Answers

If your Dart script imports dart:html or a library that imports dart:html you can run that script only from the Dartium browser (by adding a script tag to HTML that points the that Dart script, or if you run it through pub build or dart2js in any browser), but it can't be run from the console.

With dart:io it's exactly the opposite, it can't be run in the browser.

like image 174
Günter Zöchbauer Avatar answered Oct 21 '22 05:10

Günter Zöchbauer