1 min

Tags in this article

, ,

Google has released version 3.3 of the Dart programming language. The main introductions of the release are an extension types feature and a new JavaScript interop model.

With extension types, developers have a new tool to optimize performance-sensitive code, especially when working with host platforms. Extension types are an essential part of static JavaScript interoperability because they can easily modify an existing type’s interface without the wrapper’s complexity. This adaptability is crucial to any form of interoperability.

Extension types impose strict rules on the set of operations available to objects of an underlying type, also called the representation type. When defining the interface of an extension type, the developer can choose to reuse, omit, replace and add new functionality to certain parts of the representation type.

JavaScript

As for JavaScript, Dart 3.3 also introduces a new model for interoperability with JavaScript libraries and the Web. Available for this is the dart:js interop library, which provides a new set of APIs for interacting with JavaScript. Dart developers now have access to a typed API that defines the boundary between the two programming languages with static enforcement. This eliminates a series of problems during compilation.

In addition to the new APIs for accessing JavaScript code, Dart now includes a new model for representing JavaScript types in Dart using extension types.

Tip: Support JavaScript in MySQL useful, but still risky