Dartium: Chromium with the Dart VM

Dartium is a special build of Chromium that includes the Dart VM. Using Dartium means you don’t have to compile your code to JavaScript until you’re ready to test on other browsers.

To learn about other tools you can use for Dart development, see Dart Tools.

Getting Dartium

If you have an up-to-date version of Dart Editor, you already have Dartium.

Otherwise, you can download Dartium directly.

Installing Dartium

You don’t usually need to do anything special to install Dartium: just unarchive the ZIP file. If you want Dart Editor to launch a particular copy of Dartium, then put that copy inside the dart-sdk directory of your Dart Editor installation directory, replacing its original copy of Chromium.

Launching Dartium

To launch Dartium, navigate to its directory in your finder, and double-click the Chromium executable file. Or launch a web app in Dart Editor, or at the command line as described in Using command-line flags.

Linking to Dart source

Use a script tag with a type application/dart to link to your Dart source file. Example:

<!DOCTYPE html>
    <script type="application/dart" src="app.dart"></script>

    <!-- Support for non-Dart browsers. -->
    <script src="packages/browser/dart.js"></script>

For more information on linking to source code, see the article Embedding Dart in HTML.

Advanced use cases

This section contains advanced information. If you need to detect whether Dart is supported in the browser, set the API keys in order to use one of the Google APIs, or specify Dartium flags at the command line, read on. Otherwise, you can skip this section.

Detecting Dart support

You can check whether a browser supports Dart with this JavaScript code:

// In JavaScript code:
if (navigator.userAgent.indexOf('(Dart)') == -1) {
  // No native Dart support...
  window.addEventListener("DOMContentLoaded", function (e) {
      // ...Fall back to compiled JS...
  }, false);

Setting API keys

To use some features in the Google APIs, such as geolocation from the Google Maps API, you need to set the API keys in Dartium. You can either build a special version of Dartium with the API keys baked in, or you can specify the keys at runtime. For more information on how to acquire and use API keys, see API Keys.

Using command-line flags

Because Dartium is based on Chromium, all Chromium flags should work. In some cases, you might want to specify Dart-specific flags so that you can tweak the embedded Dart VM’s behavior. For example, while developing your web app, you might want the VM to verify type annotations and check assertions. To achieve that, you can enable checked mode (the VM’s --checked flag).

On Linux, you can specify flags by starting Dartium as follows:

DART_FLAGS='--checked' path/chrome

On Mac:

DART_FLAGS='--checked'              \

Or (also on Mac):

DART_FLAGS='--checked'              \
   open path/Chromium.app

Filing bugs and feature requests

To file a bug, use the Dartium issue template. To see existing issues, go to the Dartium issue list.