Release of the stable version Dart 2.0 and Dart Web Platform

Original author: Kevin Moore
  • Transfer
Note: Join the Dart Russian community on Telegram , Slack and Google+ . And at the end of the article you will find a small announcement.


Reviving Dart as a popular programming language for mobile and web development


Today we are announcing the release of the stable version of the Dart - 2.0 programming language, as well as the Dart web platform, which offers a unique combination of productivity, performance and scalability.




The Flutter developers have been using many of the features of Dart 2, since Flutter has been using preliminary versions of the Dart 2 SDK for several months now. Nevertheless, the release of the stable version of Dart 2 is another important step towards the release of Flutter due to the tight connection between the framework and the language. If you have not installed Flutter yet, you can try it right now .

With the release of Dart 2, web developers can now also use this version of the language, all libraries and tools will receive a number of improvements specific to the Web. All the necessary information on installing and creating the first application can be found here .

Dart: growing popularity


Dart 2 is a milestone in the resurgence of Darth as a popular programming language, focused on the rapid and convenient development of mobile and web applications. We want developers who create client applications to be productive: with language, framework and components that reduce the template code and allow them to focus on business logic, as well as tools that early identify errors, help in debugging and generate compact and fast code.

We are seeing a sharp increase in the popularity of Dart over the past year. Our own analytics show a tenfold increase in external use. In the last quarter, Dart was one of the fastest growing languages ​​on GitHub, measured by pull request; question growth on stackoverflowDart also shows a positive trend in popularity:



For Google, Dart is one of the few languages ​​we use to develop web applications with millions of lines of code from many different projects, including Google Ads, Google Shopping and our own projects for in-house infrastructure.

In fact, you could already use Dart without realizing it: the popular Sass style preprocessor was recently rewritten to Dartto make it faster, more portable and easier to develop. Sass is now distributed as a standalone executable on Homebrew and Chocolatey and compiled for javascript on npm. Dart makes it easy to install applications anywhere without external dependencies, as well as for deploying workflows for both Dart users and users who do not.



Dart 2 focuses on three aspects: strengthening and tightening the language, developing our support for web and mobile platforms, and creating tools and components that support using Google Dart for the outside world. The rest of this article will address these three topics.

Dart 2: language optimized for client development


As we told in February ( Russian version ) , the Dart type system is explicit . This means that before users launch your application, it will pass through a stage of analysis and compilation, during which often a large class of problems is discovered. When we were scaling Dart to extremely large applications in Google, the type system found a lot of errors at an early stage of development, which led to the creation of better code.

With Dart 2, you cannot get to the state in which the expression is executed with a value that does not correspond to the static type of this expression. This means that you can scale your code base to millions of lines, refactor large projects and deploy your code to production, being sure of it.

Do not worry: explicitness does not mean mountains of unnecessary code. The type system includes extended output — even for generic type arguments .

final _field = [3.14, 6.28];
void main() {
  // Типы не указаны, но тип <int> будет выведенprint([1, 2, 3].runtimeType); // List<int>// Если типы не указаны, будет использован их общий базовый тип// int (1) и double (3.14) оба являются типом `num`print([1, 3.14].runtimeType); // List<num>// Вывод типов работает не только на переменныхprint(_field.runtimeType); // List<double>
}

You can learn more about the Dart 2 type system on this page.

As mentioned in previous blog posts, Dart 2 also reduces language noise in several key areas: for example, the new keyword is now optional, and the const keyword is not necessarily in the appropriate context .

Finally, we did a lot of backstage work to unify the various auxiliary tools, which are now united by a common frontend that supports our compilers and execution environments . This provides consistency for our users and promises to improve the speed and quality of new features as Dart continues to evolve.

Dart 2 on the Web: a rich, powerful framework


From the very beginning, web applications were central to the Darth mission. In fact, most of the Dart development at Google is for web applications. One of the biggest is Google Ads, which provides billions of dollars to the internet economy. In the process of porting code to Dart, they reduced the size of the UI codebase by 40%, while at the same time increasing productivity and quality of applications.

While the main Dart SDK provides libraries for accessing modern browser APIs, we also support a robust Angular-based framework for building complex web applications. AngularDart 5 , supplied as part of Dart 2, takes advantage of an explicit Dart type system and a new build system.(described below) so that the user can use fast incremental builds during development and more compact compiled javascript.

One of the main directions in this version was to reduce the amount of code that is processed when the page is loaded, which significantly reduces the “time to interactivity” for web pages. In many applications, the code size has decreased by more than half compared to AngularDart 4.

To demonstrate the improvements in the Darth web platform, we created a Dart-based client implementation for HackerNews as a progressive web application; It is published along with other examples on the popular HNPWA website .. Using the best practices for creating web applications on Dart, we were able to create a full-featured application that is fully interactive in one second on modern devices and up to five seconds on a modest mobile device on a slow 3G network. It is competitive even when compared with lightweight web frameworks optimized for small applications.


https://hnpwa.dartlang.org/

Our infrastructure investments also extend to our component library , which we also updated. You now have access to 100 new classes, including various Material components . You can explore all of our components in the component gallery .


Material Date Picker is one of the components available for your web application.

Toolkit for Dart 2


Together with Dart 2, Dart becomes a first-class compiled-in-JavaScript language, with a development cycle that web developers expect and excellent performance characteristics during execution. This is achieved due to the advantages that most JS-oriented languages ​​do not provide: an explicit type system and excellent support for native mobile applications.

With Dart 2, our web tools cover a 100% JavaScript development model with two additional JavaScript compilers. The development compiler, dartdevc , provides fast incremental compilation when generating JavaScript, which is easy to read and debug. This allows our compiler dart2jsFocus on creating highly optimized javascript for progressive web applications for mobile and complex enterprise desktop applications. Both compilers use an explicit Dart type system to optimize their output.

Our web-based tools are based on a new build system designed to be fast, debug, and extensible. Now tasks such as generating code for serialization, compiling Sass in CSS and compiling Dart in JavaScript, occur in a single tool chain that supports fast, incremental updates as parts of your application change. The build system is also designed to support use outside of the Web. Example: it is used by Flutter developers to generate code forserialization in json .

Together with Dart 2 we have an extended set of tools for developers. In addition to supporting Android Studio and JetBrains tools, including IntelliJ IDEA and WebStorm , we also support Visual Studio Code with the Dart Code extension . And we also have a platform for experiments: DartPad , which has been completely updated for Dart 2.

Finally, the Dart SDK comes with a set of other useful tools: a package manager that works with our site , a static analyzer, linter, which you can use from the command line or as a package, as well as tools for web-based documentation and formatting that conforms to the standards of the Dart language .

To learn more


Learn how to get started with Flutter and the Web Dart toolkit .

The release notes provide detailed technical information about many other minor improvements made after Dart 1, some of which are critical. If you encounter problems that Google search cannot solve, we recommend starting with StackOverflow . Subscribe to the Dart Announcements newsletter and follow us on Twitter to receive updates. We would also like to see you in our communities, for example, in Gitter and edit r / dartlang .

thank


Dart has become a general purpose language that is optimized for development on the Web and on mobile devices. We have been working on Dart 2 for several years, during which time it has covered all aspects of our ecosystem and required the migration of millions of lines of code and hundreds of packages.

We’re grateful to the Dart and Flutter communities , as well as to hundreds of Google engineers who helped us on this journey. We could not have done it without you!


From the community


I would like to congratulate the Dart development team on such an important event, this is really a major milestone for the development of the language. Of course, many of the words from this article may seem to you very debatable , you can discuss them both in the comments and in our Telegram , Slack and Google+ chats .
And the promised announcement: in addition to small meetings, we hold annual big events devoted to language, tools, Flutter, AngularDart and everything connected with them. Last year we had visiting engineers from Google, we brewed a special beer , and in general it was fun. This year we will try to do even better! Therefore, book the end of November - the beginning of December, and follow the announcements.

Also popular now: