Web Development in Google Dart

Web Development in Google Dart

The mainstream Dart web development route is now writing code with Dart but compiling and running as JavaScript using webdev, which works with the build_runner utility.

 

Installing

You will have to install the webdev package using the pub dependency manager:

pub global activate webdev

 

This installs webdev and makes sure it is available on the command line.

 

Commands

webdev serve
Runs a development server that continuously builds a web app.

webdev build
Builds a deployable version of a web app.

build_runner test
Runs tests.

 

JavaScript Compilers

When you invoke webdev, it invokes the dart2js and dartdevc JavaScript compilers in combination with the webdev and build_runner utilities.

When you’re developing your app, webdev chooses dartdevc, which supports incremental compilation so you can quickly see the results of your edits.

When you’re building your app for deployment, webdev chooses dart2js, which uses techniques such as tree shaking to produce optimized code.

More Reading: https://webdev.dartlang.org/tools/webdev.