Questions tagged [dart2js]

The Dart to JavaScript compiler that reads a Dart file and translates it to JavaScript.

The Dart to JavaScript compiler that reads a Draft file and translates it to JavaScript. It generates JavaScript source code from the Draft files. The name of the tool used to compile the code is draft2js. Dart Editor uses dart2js behind the scenes whenever Dart Editor compiles to JavaScript. It produces a file that contains the JavaScript equivalent of the Dart code. It also produces a source map, which can help to debug the JavaScript version of the app more easily.

196 questions
4
votes
1 answer

Writing a WebWorker in Dart (without dart:isolate)

I'm in the process of creating a web application, written in Dart, that requires the creation of independent paths of execution, also written in Dart. (Were we not working in the browser, I would call them "threads.) Normally, I would utilize Dart's…
Zane Kaminski
  • 529
  • 4
  • 13
4
votes
1 answer

Get variable from JavaScript into Dart

I have a JavaScript library being imported in my HTML Documents head. How can I access objects from this library? Thank you.
Nestor Ledon
  • 1,925
  • 2
  • 23
  • 36
3
votes
1 answer

Why would a Firebase Cloud Function be much slower once deployed than in the emulator, other than cold starts?

I have a Firebase Cloud Function that parses some HTML among other things. I've measured the HTML-parsing method itself, and it takes about 300ms in the emulator on a MacBook Pro. It seems to take about 4-8 seconds when deployed to Firebase, which…
Bryson Thill
  • 494
  • 4
  • 13
3
votes
0 answers

Is there a way to turn off tree shaking when I build a flutter for web app with the "Flutter build web" command?

I am trying to put a prototype of my flutter app on the web so I can show it to some people but in release mode some features are broken while in debug mode they are not. I want to turn off tree-shaking to see if that might be causing the…
lost baby
  • 3,178
  • 4
  • 32
  • 53
3
votes
1 answer

dart check if is building

I would like to skip some specific code on pub build. example: Log.print('something ${StackTrace.current}'); I would like that the code above was not transpilled to JS in production.
Jonathan
  • 4,724
  • 7
  • 45
  • 65
3
votes
1 answer

dart2js attempting to compile css?

It looks as though dart2js is trying to compile bootstrap's css files. I've tried to google the issue, but I couldn't find anything useful. I guess that's because I'm not really sure what I should be googling. My last project went fine, and because…
Hector
  • 659
  • 1
  • 11
  • 25
3
votes
1 answer

Is it possible to configure `pub build` so that it does not suppress hints and warnings?

I'm trying to not get messages like this when I run pub build: WARN: [Dart2JS on mylib|web/mylib.dart]: | 1 warning(s) and 2 hint(s) suppressed in package:otherlib. WARN: [Dart2JS on pinged|web/mylib.dart]: | 2 warning(s) suppressed…
Lucas Meadows
  • 2,939
  • 2
  • 14
  • 4
3
votes
0 answers

Manually run pub transformer in Dart

I have a complex project and I have multiple entry point. I was manually running dart2js, but I'm trying to use aync_await library. The library require the the transformer async_await. The problem is that dart2js doesn't automatically run the…
darkzangel
  • 939
  • 9
  • 17
3
votes
2 answers

Dart2JS Cannot Find Import Packages WebStorm

I am using the WebStorm 8 IDE to build a dart web app. I have the following directory structure: root web main.dart lib packages browser intl intl.dart pubspec.lock pubspec.yaml In main.dart I have the…
shortspider
  • 1,045
  • 15
  • 34
3
votes
2 answers

Dart chrome extension: Listen to chrome api events

To better describe my problem i have created a small example of a chrome extension written in Dart. You can see the code or download the extension on Gist. The problem This example is running fine in Dartium, but when compiled to javascript a…
Andi
  • 224
  • 2
  • 10
3
votes
2 answers

Why `final var` is illegal in Dart?

The analyzer doesn't say final var is illegal. but dart2js says final var is illegal What is correct? Why?
Sungguk Lim
  • 6,109
  • 7
  • 43
  • 63
3
votes
1 answer

Polymer + Dart2js Not Working

When I create a new application using the Polymer library, it generates a sample project. The project works just fine in Dartium, but when I compile it (using pub build), it doesn't work anymore. I get two 404's and an uncaught typeerror. Here is my…
Michael Peterson
  • 348
  • 6
  • 22
3
votes
1 answer

Getting error converting dart2js on polymer project

Unsupported operation: Can't use ownerName in reflection because it is not included in a @MirrorsUsed annotation. ownerName is just an published attribute on the polymer element. I understand there are a few things out there (on web, not on here)…
user1318747
  • 345
  • 4
  • 12
3
votes
4 answers

Removing link to Dart file kills app

I am trying to run my Dart app in Firefox (v22.0). Here is the app's homepage: My 1st Dart App
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
3
votes
2 answers

Dart Package Management via dart2js

I'm learning Dart and its dependency manager pub and am having a tough time seeing the "forest through the trees" here. Say I want to use Polymer.dart in my project. So, in my project root, I create the following pubspec.yaml: name:…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
1 2
3
13 14