|Dart 2.1 Is Smaller And Faster|
|Written by Kay Ewbank|
|Friday, 30 November 2018|
Google has updated Dart with a new version, 2.1, that has smaller code size, has faster tools, and offers faster type checks.
Dart 2 also included a sound type system. In other words, you can't create expressions that evaluate to a value that doesn’t match the expression’s static type. Dart’s type system enforces this using a combination of static checking (compile-time errors) and runtime checks.
However, despite the sound checking, the new version includes support for int-to-double conversion to avoid errors caused when an expression expects a double but gets an integer.
The new version also has better support for mixins. These provide a way of reusing a class’s code in multiple class hierarchies, and Dart 2.1 introduces a new syntax for mixins, with a new mixin keyword that you can use to define classes that can only be used as mixins. They can also now extend other classes and can invoke methods in their superclass.
The performance improvements apply to specific groups of developers, in particular Flutter developers and Web developers. Flutter is Google’s mobile app SDK that can be used to create native interfaces on iOS and Android. It uses Dart as its language, and the updated version has been changed so that the checks added by the new type system no longer cause a large overhead. Web developers should also see an improvement as the code size and compile time for Dart code running on the web has been improved; the development team for Dart say they've seen good results, such as a 17% reduction in minified output size and 15% improvement in compilation time in some cases.
Other changes to the new version include support for protocol buffers. These are a language-neutral, platform-neutral way to serialize structured data. The mechanism is being widely adopted abd supported, and is used extensively inside Google.
Another improvement is support for serving Dart code on knative. This is a platform based on Kubernetes that supports building, deploying, and managing serverless workloads. The Dart team says they know knative will probably be too low-level for most Dart app developers, but think it might become a critical building block to get better support for serving Dart code in the Google Cloud in situations such as creating backends for Flutter apps.
The Dart SDK 2.1 is now available for download from the Dart homepage, while Flutter developers will find it included as part of the Flutter 1.0 release.
or email your comment to: email@example.com
|Last Updated ( Friday, 30 November 2018 )|