Dev

Dart language upgrade shines on Wasm, generative AI


Dart 3.3, the latest update to Google’s programming language for building mobile, desktop, and web applications, has arrived, bringing experimental support for web applications compiled to WebAssembly. Google also released an SDK for building generative AI capabilities into Dart and Flutter apps.

Dart 3.3 was launched February 15. Instructions on downloading the Dart SDK can be found at dart.dev. Dart powers the Flutter framework for multi-platform UI development.

Dart 3.3 allows application and package authors to begin laying the groundwork for web applications compiled to WebAssembly. While WebAssembly support in Flutter Web remains experimental, the team is working to stabilize the implementation. To run Flutter applications on the web using WebAssembly, developers must migrate all code, from the application to dependencies, to use a new JavaScript interop mechanism in Dart and package:web. The Dart team has provided a migration guide to help developers start using WebAssembly.

Alongside Dart 3.3, Google introduced the Google AI Dart SDK, which allows developers to build generative AI features into their Dart or Flutter apps using the Gemini API. Gemini is Google’s largest and most general generative AI model, capable of processing information from both images and text. Developers can read up on using the Google AI Dart SDK via a quickstart guide.

Dart 3.3 also debuts a new model for interoperating with JavaScript libraries. (Dart once was positioned as a rival to JavaScript.) A new set of APIs for interacting with JavaScript, the dart:js_interop library, include a typed API, which defines the boundary between the two languages with static enforcement. This eliminates a class of issues before compile time, Google said. Additionally, Dart now includes a new model for representing JavaScript types in Dart using extension types.

Extension types in Dart 3.3 introduce zero-cost wrappers for types. Developers can use extension types to optimize performance-sensitive code, especially when interoperating with host platforms. Extension types provide the convenience of custom types with unique members while eliminating wrapper allocation overhead. Thus native types can be used directly without the cost of creating wrappers and the associated indirection, Google said.

Copyright © 2024 IDG Communications, Inc.



READ SOURCE

This website uses cookies. By continuing to use this site, you accept our use of cookies.