Google is preparing to launch version 3.0 of the Dart programming language later this year, requiring sound null safety and introducing new features.
Dart is one of many programming languages that Google has created over the years, joining the likes of Go and upcoming language Carbon. After initially launching as an alternative to JavaScript for web development, Dart is now prominently used in Google’s cross platform app development framework, Flutter.
Today, at the Flutter Forward event, Google shared its plans for the next major release of Dart, version 3.0, set to release later this year.
Back in 2021, Dart introduced the idea of sound null safety — a relatively common feature, but one that’s rare to see added to an established language. By being certain ahead of time whether a variable can be null, the compiler can make optimizations to squeeze out a little better performance and help you catch potential mistakes in code.
While sound null safety started as an optional feature for Dart, it’s going to become a requirement for code written for Dart 3. This is a breaking change and is likely one of the biggest reasons why this is a major version release instead of continuing in Dart 2.x. Thankfully, Google shared statistics showing that 98% of the top 1,000 packages available for Dart have already taken the necessary steps to support sound null safety and should be ready for Dart 3.
Developers will also find some helpful new features being introduced with Dart 3, starting with new “Records” and “Patterns.” In the simplest examples, these make it possible for a function to simultaneously return more than one value and assign them to particular variables, as appropriate. The goal here is to let Dart developers work with structured data more efficiently.
Dart 3 is also set to massively expand the language’s FFI capabilities — initially offered as a way for Dart code to work with libraries and code written in C — to support interop with Swift and Objective-C on iOS/Mac and Kotlin on Android. In an early sample app, you can see how a pedometer app built with Flutter can call into Core Motion on iOS and Health Connect on Android.
With this release, Google is also introducing support for Dart to run on three new platforms. For web developers — and particularly for the benefit of Flutter on the web — it should soon be possible to compile Dart code to WebAssembly, enabling near-native performance. To make this possible, WebAssembly needs to gain support for garbage collected languages like Dart, which has required months of work in collaboration with the Chrome team and other WebAssembly partners.
Staying ahead of the curve, Dart 3 will be the first version of the language to support the up-and-coming RISC-V architecture, with the intention of Flutter apps being able to run on such devices as well. This is a reflection of Google’s broader efforts into RISC-V, with Android actively working to support the new hardware. On the Windows side, Dart 3 will also include support for Windows on ARM devices.
Google didn’t have an exact timeline of when to expect Dart 3 to be released, beyond confirming it will happen later this year. That said, developers can get hands-on with an alpha version of Dart 3 today by either installing a “dev” build directly or switching to the “master” channel of Flutter.
Image: Google
FTC: We use income earning auto affiliate links. More.
Comments