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

Dart polymer.dart dart2js

I made an application with dart / polymer / sockets, and i want to compile it in Javascript. But I don't know how to do. I tried to do "Generate Javascript", but it said "You do not have main entry point". Should I compile manually each dart files ?…
1
vote
1 answer

Which dart2js command is launched by DartEditor?

After reading article found at https://www.dartlang.org/articles/web-ui/tools.html, I tried to compile my application by following it. My application stored in web/app.html can be successfully compiled to Javascript under DartEditor by using "Run as…
sestegra
  • 77
  • 9
1
vote
2 answers

Is there any tool like gruntjs can convert dart to js when project file changes?

I'm looking for a tool like "gruntjs" which can monitor my dart project, and when file changes, it's able to: convert dart files to javascript files restart my custom dart command: dart app.dart I don't find any plugin for gruntjs to do this, is…
Freewind
  • 193,756
  • 157
  • 432
  • 708
1
vote
2 answers

dart2js compiled code running in an unsupported browser

What happens if I try to run my generated javascript code in an unsupported browser? Like IE6? I don't want to end up in a situation that my users will see a partly working broken app. Is there a way how to ensure that the dart/javascript will run…
user7610
  • 25,267
  • 15
  • 124
  • 150
0
votes
0 answers

dart to js: how do i get document of iframe

I am using Dart 2 JS to execute Dart code in the browser. There is an iframe element (src is of the same domain) in my HTML. I want to use Dart to get the body of the html inside the iframe. final iframes =…
Flafy
  • 176
  • 1
  • 3
  • 15
0
votes
0 answers

how can I prevent class and its members from being tree shaken?

I would like to make sure that a class and all its members are not tree shaken when compiled with Dart2JS. There used to be a MirrorsUsed annotation but that is long gone. Anyway to do that nowadays without having to create an object of the class…
Jonathan
  • 4,724
  • 7
  • 45
  • 65
0
votes
1 answer

Is there a way to call Flutter web platform native code?

is there an approach to have something like a method channel on Flutter web apps to call to the javascript host?
soft_and_ware
  • 87
  • 1
  • 8
0
votes
1 answer

access html method that is not defined in dart2js

I need to access the replaceTrack method of the RtcRtpSender, however, it is not defined in the dart2js file: @Native("RTCRtpSender") class RtcRtpSender extends Interceptor { // To suppress missing implicit constructor warnings. factory…
Jonathan
  • 4,724
  • 7
  • 45
  • 65
0
votes
1 answer

how to build two versions with webdev build?

is it possible to compile two versions when building? I would like to have a build/ which is the production release for end users and a buildDev/ with less restrictive dart2js flags. Something like that. The idea is to be able to access a page…
Jonathan
  • 4,724
  • 7
  • 45
  • 65
0
votes
1 answer

Flutter Web: What are the side effects of using it to build a web app

Recently, I have been exploring the Flutter API tools and builds, even the flutter-web project. So what I really want to understand is the flutter-web support which makes it possible to compile an existing or new app into a web app, to run on web…
John Zenith
  • 472
  • 5
  • 10
0
votes
1 answer

JS Interop works with DDC but not with Dart2JS

Dart 2.7 build_runner: 1.7.3 build_web_compilers: 2.9.0 I've created an interface for GoJS using the package js: https://github.com/jodinathan/gojs_dart/ The problem is that it works flawlessly in DDC but throws an exception when using with…
Jonathan
  • 4,724
  • 7
  • 45
  • 65
0
votes
1 answer

Dart mapping Function as constructor with node interop

I've recently started with development in Dart. I need to run Dart on the node vm. Currently, I am required to create an interop to an external node module. This module only exposes constructor functions. I am unable to find a way to create a Dart…
Shane
  • 3,049
  • 1
  • 17
  • 18
0
votes
1 answer

Issue building project with JavaScript APIs

Whenever I serve my project with the --release options or I build it, and run it on the webpage, I'm getting this errors console, and some features won't work, using the dartdevc compiler all the functions works fine. For example this happens when…
Mattia
  • 5,909
  • 3
  • 26
  • 41
0
votes
1 answer

Migrating to Dart 2 I get a "check imports error" that means that some templates have not been generated

I'm trying to migrate to Dart 2, I have a lot of packages and up to now I could do my job with not so much problems. Now I'm getting a strange error bot with DDC and dart2js: [SEVERE] build_web_compilers|entrypoint on web/main.dart (cached): Unable…
J F
  • 1,058
  • 2
  • 10
  • 21
0
votes
1 answer

Build a non minimized project with dart2js

Have a project builds and runs with webdev serve ok. With webdev build it builds and deploy fine, but crashes when loading in the browser. In order to do better debugging I would like a non-minimized build, but got hit by some other error. Have now…
Jonas Bojesen
  • 855
  • 1
  • 8
  • 22