|Google Dart 3 Adds Record Support|
|Written by Kay Ewbank|
|Thursday, 25 May 2023|
Dart 3 has been released with support for records, patterns and class modifiers. The new release is also a fully sound, null safe language.
The move to become a fully sound null safe language has been achieved by major changes including the removal of several historical Dart language and SDK artifacts, including removing support for running without sound null safety. Null safety was introduced in Dart 2.12 to help developers avoid null errors, a class of bugs that are often hard to spot.
The move to 100% null safety in Dart means developers can trust that if a type says a value isn't null, then it never can be null. In addition to avoiding null pointer exceptions, it also allows Dart's compilers and runtimes to optimize code in ways it couldn't without null safety.
The new version also has new support for structured data with records. Originally, a Dart function could only return a single value, and developers who wanted to return multiple values had to either package these into other data types such as maps or lists or to define new classes that could hold the values. The new records are value types that look like list literals but use parentheses instead of brackets. Records can be used for function return values, can be stored in variables, put into lists, or hold other records.
Other improvements in the new release include pattern matching and class modifiers. Pattern matching can be used to decouple a record into its constituent types, while class modifiers let API authors support only a specific set of capabilities.
Dart 3 is available now.
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
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.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Thursday, 25 May 2023 )|