O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Compiling to JavaScript

It is great that we have our enhanced text editor application running in Dartium, but that is not what most web users have installed. What if I want to use it in my daily-driver web browser; for example, Firefox or Internet Explorer?

In order to run on the entire modern Web, Dart code can be compiled via a tool called dart2js (written in Dart) to high quality and performance JavaScript. This can be run as a pub command:

pub build --mode=release

We first encountered this tool when we toured the SDK's command-line tools in the previous chapter. For easy use during development, it is accessible from WebStorm.

In WebStorm's Project tab, right-click on the pubspec.yaml file, and select Pub: Build .... The mode option is then presented ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required