Wednesday, February 21, 2024

Google Release Dart Language 3.3 with WebAssembly Support & Introduce Support for RHEL 8/9

 Google has released Dart 3.3, positioned as the foundation for web applications compiled to WebAssembly, featuring a new model for JavaScript interop and introducing a feature called extension types.



The popularity of Dart is closely tied to Flutter, a cross-platform framework for mobile, web, and desktop that utilizes Dart. Dart can compile to native executables for Arm32, Arm64, or x86_64, as well as to JavaScript.


The Flutter team has expressed interest in compiling to WebAssembly, which Dart currently supports experimentally. In a March 2023 event in Barcelona, Kevin Moore, Google Flutter and Dart product manager, mentioned performance improvements of "1.5 to, in some cases, 3 times" compared to compilation to JavaScript. Unlike Microsoft's C#, Dart compiled to WebAssembly uses WasmGC, the new standard API for garbage-collected languages in Wasm, although it currently only functions in Chromium-based browsers and Firefox, not in Safari.


Dart 3.3 marks a significant step towards the production use of WebAssembly support, introducing a new model for JavaScript interop. This model provides Dart developers with access to a typed API for interacting with JavaScript, utilizing extension types described as a "compile-time abstraction that 'wraps' an existing type with a different, static-only interface." This approach allows modifications to an existing type's interface without any additional runtime overhead, making it suitable for efficient JavaScript interop.


The new JavaScript interop model is essential for WebAssembly support but requires migrating older code. Developers maintaining public Flutter packages using dart:html or other Dart SDK web libraries are advised to migrate to package:web as it replaces dart:html and other web libraries as Dart's long-term web interop solution, resulting in some expected friction during the transition.


While WebAssembly support is primarily targeted at Flutter, it has broader potential use cases. The team notes that "Although Wasm was originally designed for running native code on the web, Wasm has since evolved into a general technology for running compiled code across multiple platforms." Future possibilities may include using WebAssembly-compiled Dart for server-side code.


Additionally, Dart 3.3 introduces support for RHEL 8 & 9 as source OSes, and the same for Ubuntu 22.04 and 20.04. In a parallel development, Google has released an AI Dart SDK utilizing Google's Gemini AI models via the package:google_generative_ai. This SDK is expected to support various applications such as text summarization, chatbots, visual search, and interpreting charts and diagrams. Dart support will soon be added to Google's AI Studio, indicating how Google leverages its Dart and Flutter projects to guide developers towards its AI services.

0 comments:

Post a Comment