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
3
votes
1 answer

How to prevent onBeforeUnload listener in dart from prompting the user?

I basically want just to listen for 'onbeforeunload' to make sure the user won't receive 'connection lost' error messages from my ajax calls. i therefore registered an event and simply set a variable to true that i know to not bother the user with…
Herbert Poul
  • 4,512
  • 2
  • 31
  • 48
3
votes
1 answer

js interop compiled with dart2js error - Uncaught NoSuchMethodError : method not found:

I generated a sample Polymer web project. Added following js file. jslib.js function testfunction() { alert("test"); } in clickcounter.dart I added dependency import 'package:js/js.dart' as js; and changed increment() function void increment() { …
Juri Krainjukov
  • 732
  • 8
  • 27
3
votes
2 answers

Bitwise operations, wrong result in Dart2Js

I'm doing ZigZag encoding on 32bit integers with Dart. This is the source code that I'm using: int _encodeZigZag(int instance) => (instance << 1) ^ (instance >> 31); int _decodeZigZag(int instance) => (instance >> 1) ^ (-(instance & 1)); The code…
Fox32
  • 13,126
  • 9
  • 50
  • 71
3
votes
1 answer

In Dart, how does the event queue/event loop differ between Dart2JS and the Dart VM?

Is there any difference in the order of execution? Or does the event queue/loop work differently in JavaScript than Dart?
Juniper Belmont
  • 3,296
  • 2
  • 18
  • 28
3
votes
2 answers

Passing typed array buffer to javascript from dart with js-interop

Trying to call a javascript method that required a typed array. var arrayData = js.array(new Uint8Array.fromList(data.charCodes)); Using js.array does not proxy it the way I was expecting, how could I pass the typed array as a typed array to a…
adam-singer
  • 4,489
  • 4
  • 21
  • 25
2
votes
0 answers

How to convert Flutter package to JavaScript

Whether it is possible to convert the entire Flutter package to JavaScript or else how to convert a single dart file to a JavaScript file. If I try to convert a single dart file to a JavaScript file using dart2js, it is failed like the main method…
Chinnu
  • 556
  • 1
  • 5
  • 12
2
votes
0 answers

How Can I disable minify for flutter web release build

How can I disable minification for a Web release build? It is messing up my JSON conversion and I don't want to rewrite all HTTP Layer. My application works fine in debug & profile build for the web and works fine with release build for Android &…
Atiq Samtia
  • 114
  • 1
  • 8
2
votes
1 answer

Change webdev serve directory

prentend that I have a file in .../web/main.dart and when I'm serving the app ( webdev serve web:8080) it will be located in localhost:8080/main.dart.js and the packages in localhost:8080/packages/ is there anyway to move them to…
Mattia
  • 5,909
  • 3
  • 26
  • 41
2
votes
1 answer

How AngularDart 4-5 change detection is different from Angular 5 change detection?

As I know it, change detection of Angular 5 is implemented using Zone.js. According to Zone.js GitHug page it was inspired by zone in Dart language. Unfortunately Zone.js is very intrusive library, because it patches Standard browser objects, like…
como eStas
  • 43
  • 3
2
votes
1 answer

Calling Dart from Javascript

How can I let the dart to js compiler export a dart api to js with a direct mapping from the original dart api to the js api resulting from transpilation? The purpose is simply to write a library in dart and use it from js. There is no problem…
user3464741
2
votes
2 answers

Dart - dart2js and further size-optimization

I already using the minify argument when building with dart2js. I looked at the output and I see that the import 'dart:html causes problems in terms of the output file size (2kb .dart file becomes 182kb .js file). For example it imports SVG package…
user64675
  • 482
  • 7
  • 25
2
votes
0 answers

Dart's @MirrorsUsed annotations and `part` directives, how to?

I have a bunch of @MirrorsUsed(targets: '...') annotations, however the problem with them is that because all part statements go below them, dart2js complains. For example, here's how it goes in the file: library foo; @MirrorsUsed(targets:…
orion3
  • 9,797
  • 14
  • 67
  • 93
2
votes
1 answer

dart2js compiled Polymer Dart application is not running in IE 11

I am unable to get a dart2js compiled polymer dart project to even load in IE 11. I am a bit confused since it runs in Chrome and Firefox perfectly fine. Here are my steps: Used stagehand to create a new web-polymer application. Without changing…
Darryl Faint
  • 125
  • 1
  • 1
  • 6
2
votes
1 answer

Call a javascript function of Chromecast Receiver Library with JSON parameter in Dart

i have this JS function call: this.customMessageBus = castReceiverManager.getCastMessageBus('urn:x-cast:mycastapp', cast.receiver.CastMessageBus.MessageType.JSON); var errorMessage = { action: 'ERROR_MESSAGE', …
Andrea Bozza
  • 1,374
  • 2
  • 12
  • 31
2
votes
2 answers

Is there any way to improve Dart (dart2js) compile times?

I'm trying to move from TypeScript to Dart. TypeScript compiles almost immediately - Dart takes more than 5 seconds to compile a Hello World program! Am I missing something? Are there any possible ways to improve that?
cubuspl42
  • 7,833
  • 4
  • 41
  • 65