dartdevc: The Dart Dev CompilerSend feedback
The Dart development compiler (dartdevc, also known as DDC)
lets you run and debug your Dart web app in Chrome.
As of SDK release 1.24,
pub build and
pub serve support dartdevc.
When you use
pub serve with dartdevc,
you can edit your Dart files,
refresh in Chrome,
and see your edits almost immediately.
This speed is possible because pub compiles only updated modules,
not all the packages that your app depends on.
The first compilation with dartdevc takes the longest,
because the entire app must be compiled.
After that, as long as
pub serve keeps running,
refresh times with dartdevc are much faster than with dart2js.
Preparing your code
To compile with dartdevc, your web app’s code—and all packages it depends on—must be type safe. For practical details on how to make your code type safe, see the list of common errors and warnings. More information is in the sound Dart guide.
For best performance, put implementation files under
instead of anywhere else under
Also, avoid imports of
pub package layout conventions
have more information about how to structure your code.
The following repos have good examples of app code that works with dartdevc:
Building with dartdevc
To make pub use dartdevc, do one of the following:
Modify your pubspec. A new top-level key named
websupports a single key named
compilerthat maps mode names (such as
release) to compilers (
pub serveuse dartdevc (assuming
pub serveruns in its default mode,
debug), put the following in your
web: compiler: debug: dartdevc
Alternately, use the new
pub serve. Specify the
pub build --web-compiler=dartdevc
Testing with dartdevc
You can use dartdevc to run your tests in Chrome much more quickly than is possible with dart2js. To run a test in Chrome, use the following commands:
pub serve test --web-compiler=dartdevc pub run test -p chrome --pub-serve=8080