DDC is built upon Dart's sound type system. It only compiles programs that statically type check (i.e., no strong mode errors). It leverages static type checking to generate simpler, readable, and more idiomatic code with fewer runtime checks. In general, DDC is able to provide stronger type guarantees - i.e., soundness - than traditional Dart checked mode with significantly fewer runtime checks.
With strong mode, DDC is stricter than traditional Dart production mode or checked mode. Running existing Dart code on DDC will generally require fixing both static and runtime type errors.
For example, although the following snippet will run in production or checked mode, it will fail to compile with DDC:
var list = ["hello", "world"]; // Inferred as List<String> in strong mode List<int> list2 = list; // Static type error: incompatible types
On the other hand, the following snippet - which tries to mask the type error via casts - will compile with DDC, but fail with a runtime type error.
var list = ["hello", "world"]; List<Object> list2 = list; // Generics are covariant. No runtime check required. List<int> list3 = list2; // Implicit runtime downcast triggers error.
There are some import caveats where Dart concepts do not map directly:
HashMap$(core.String, core.int) produces a class that represents a HashMap from strings to ints). Similarly, generic methods are mapped to factories that, given one or more type parameters, return a method.
dynamic type), but it will typically generate less readable and less efficient ES6 output as many type checks must be deferred to runtime. All dynamic operations are invoked via runtime helper code.
a._x may map to
_x is a symbol only defined in the scope of the generated library.
In general, the current conventions (i.e., the Application Binary Interface or ABI in compiler terminology) should not be considered stable. We reserve the right to change these in the future.
DDC currently supports Chrome stable (though users have had success running on FireFox and Safari). In the near future, we expect to target all common modern browsers that support ES6. ES6 itself is in active development across all modern browsers, but at advanced stages of support: