Dart 3 Will Be Fully Sound And Null Safe
Written by Kay Ewbank   
Monday, 19 December 2022

The next version of Dart will be "a fully sound null safe language" according to the Dart development team, and in order to achieve this several historical Dart language and SDK artifacts are being removed, including removing support for running without sound null safety.

Dart is a client-optimized language designed to provide a way to create fast apps on any platform. It began life as an alternative to JavaScript that would be supported directly by browsers, but when this didn't work out it was redeveloped by Google as a better compiler. Dart is object-oriented and class-based with a C-style syntax.

dartlogo

Null safety was introduced in Dart 2.12 to help developers avoid null errors, a class of bugs that are often hard to spot. For Dart 3 the developers are pushing this even further. Until now the null safety support in the Dart language made variables non-nullable by default, and only allowing nulls when explicitly declared.

Version 3 of Dart will only support sound null safety, which guarantees that a non-nullable variable never contains a null value. Some pubspec files will stop resolving in Dart 3 and later, and any source code containing language markers will fail when you set the constraint to less than 2.12 (e.g. // @dart=2.9).

The Dart team says they believe that around 85% of all executions of flutter run use sound null safety at this time. Those developers who have apps or packages in the remaining 15% need to migrate before Dart 3 ships (expected around mid-2023). To help you achieve this the team has put together the following video:

 

Alongside the null safety change, some other "historical artifacts in the Dart language and core library APIs" are being removed, including the discontinued core library APIs, removing a historical syntax for default parameter values, and requiring tear-offs to be explicit.

There are some additions to Dart 3, including improved interoperability with other programming languages and new language features, but details of most of these are still under wraps.

 

dartlogo

More Information

Dart website

Related Articles

Dart 2.12 Released With FFI

Dart 2.6 Adds Native Linux Support

Dart 2.1 Is Smaller And Faster

Dart 2 Released With New Mobile Focus

Google's Dart Reborn As Cross Platform App Language

Dart Changes Course - No Longer To Be Native In Chrome

The Astonishing Rise Of Dart

Ecma Approves Dart

 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


pgxman - PostgreSQL Extension Manager
19/02/2024

pgxman is a package manager like npm, but instead of Javascript packages, it is for PostgreSQL extensions. It detects and streamlines extension operations and looks after dependency manageme [ ... ]



Android 15 Developer Preview Released
19/02/2024

Android 15 Developer Preview has just been released by the Android team with features including partial screen sharing and the latest version of the Privacy Sandbox.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info