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 was originally created as an alternative to JavaScript that would be supported directly by browsers rather than being compiled to JavaScript. This never caught on because other than Chrome,  browsers never added support, and even Chrome dropped support after a while. Instead, Dart was redeveloped as a better compiler.

dartlogo

When Dart was released earlier this year, the rewritten version was revealed to be strongly typed by default, class based, and treats functions as objects. Mike James described Dart 2 back when the beta was revealed as resulting from taking modern JavaScript - say ES2015 - and adding a true hierarchical type system to it, and with a chance of being used in the mobile app world.

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.

dartmixin

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.

 

 

dartlogo

More Information

Dart

Flutter

Related Articles

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

Dart 1.8 Adds Support for App Engine and enums

Dart + Chromium = Dartium

Angular Partners With TypeScript

 

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


Lightbend Announces Akka 3
15/11/2024

Lightbend, the company that developed Akka, has announced Akka 3, and has changed its name to Akka. The company produces cloud-native microservices frameworks, and Akka is used for building distribute [ ... ]



Google Updates Responsible AI Toolkit
01/11/2024

Google has announced updates to the Responsible Generative AI Toolkit to enable it to be used with any LLM model. The Responsible GenAI Toolkit provides resources to design, build, and evaluate open A [ ... ]


More News

espbook

 

Comments




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

Last Updated ( Friday, 30 November 2018 )