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
1
vote
1 answer

dart2js js code `undefined is not a function`

I'm trying to compile in javascript my project. Compilation works, but in browser (chrome) I have: Uncaught TypeError: undefined is not a function client.dart.js:14753 J.get$length$asx…
Druxtan
  • 1,311
  • 2
  • 15
  • 21
1
vote
2 answers

Dart polymer transformer to js issue

How can I avoid embedding css files to output html files during pub build (generate js)? Is it possible? note: polymer version is 0.10.0-pre.11 Before pub build:
Roman
  • 2,145
  • 4
  • 26
  • 33
1
vote
0 answers

Not able to run angular dart app in firefox

Recipebook Angular dart app not working in firefox 28.0 (Mac OSx),App is running fine on chrome and safari. Stack trace (debug mode) : "listen ignoreClick=false" main.dart.js:36580 "NoSuchMethodError : method not found:…
invariant
  • 8,758
  • 9
  • 47
  • 61
1
vote
0 answers

TransitionFunction_linear is not a function

Output code from dart2js throws exception before it runs my code. Line of code: $.TimelineTween__linearEase = Z.TransitionFunction_linear$closure(); $ is undefined Z is dart Performed in Isolate loading. mozilla: TypeError:…
Zdeněk Mlčoch
  • 722
  • 6
  • 17
1
vote
1 answer

How to create previous-dart objects from dart2js output?

Assumed that I code some type of library and convert it to js (per dart2js). How can I access the prototypes to create objects? What is right way to resolve dart-namespaces?
NaN
  • 3,501
  • 8
  • 44
  • 77
1
vote
1 answer

Dart2Js w/ Polymer Runtime-Error

My Dart-App works fine in Dartium, but when I compile to js there is this error: Uncaught TypeError: Object # has no method 'registerElement' My pubspec looks like this: name: Capira_v8 description: Capira v8 dependencies: …
LinusK
  • 337
  • 2
  • 11
1
vote
1 answer

Which way to go with these bugs

Compiling Dart app to js these two errors arise: Nº1: InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element': a type with that name is already registered. Nº2: Breaking on exception: TypeError: Object # has no…
marcelo
  • 69
  • 6
1
vote
1 answer

Write a WebWorker in Dart

I have compiled some dart code to javascript, and I want to run this code within a webworker. I don't attempt to access the DOM or anything in the worker, so it should work fine. However, I cannot respond to the onmessage event or call postMessage.…
Zane Kaminski
  • 529
  • 4
  • 13
1
vote
1 answer

dart2js throwing no such file or directory error

Quite simply, I have a link to dart2js in my /usr/local/bin/ which throws repeated erros when run. I ran sudo ln -s /Users/macbook/Development/dart/dart-sdk/bin/dart2js /usr/local/bin/dart2js When running dart2js from terminal, I'm presented with…
Cereal
  • 3,699
  • 2
  • 23
  • 36
1
vote
2 answers

Compiled AngularDart fails with error in dynamic_injector

I have been trying to make AngularDart work but I always get exceptions for undefined objects. @MirrorsUsed( targets: const [ 'angular.core', 'angular.core.dom', 'angular.core.parser', 'angular.routing', 'angular.core.zone', …
Vladimirs Matusevics
  • 1,092
  • 12
  • 21
1
vote
2 answers

Dart2JS compiler exception when minify is used on google_maps package

I have been building a web application with Dart and AngularDart upon Google Maps. I noticed a problem since the begin of the process even though I tested the development Dart sdk, and today the latest dart sdk (version 1.0.0.10_R30798) and still…
Lambros Petrou
  • 101
  • 1
  • 10
1
vote
1 answer

Dart: Initialize enum from JavaScript var

In my HTML file I have: Then, in my Dart code: import "dart:js" as js; String SERVER_NAME = js.context["serverName"]; String SIGNIN_PLACE_URL = "http://$SERVER_NAME/signin"; String…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
1
vote
1 answer

Bizarre Dart compiler warnings on http lib

I'm trying to use Dart's http library for making simple HTTP GET and POST requests: import 'package:http/http.dart' as http; import 'package:http/src/response.dart'; void main() { String json = getSomeJSONString(); http.post(url, body:…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
1
vote
1 answer

$ in '--global-js-name==', JQuery compatibility and Sublime Text - Build Systems

By default JS script generated by dart2js has global name $ same as JQuery so it can be problematic to use both simultaneously. To solve this problem dart2js has parameter --global-js-name=={GLOBAL NAME} but {GLOBAL NAME} must match \$[a-z]*…
JAre
  • 4,666
  • 3
  • 27
  • 45
1
vote
2 answers

Chrome content scripts in Dart

Is it possible to use dart for chrome extension content scripts? The following does not seem to call anything in main() import 'dart:html'; import 'package:js/js.dart' as js; void main() { js.context.alert('Hello from Dart via JavaScript'); …
WeaZeLb0y
  • 83
  • 6