Dart Summit 2018: Key Thoughts

    More than a week ago, the largest and most important Dart language conference was held . Your humble servant was there (and even stood on the stage a little), so before you is a report on how it was. Very subjective, I must say. Everything is interspersed: news about the language, my own impressions, photos and stuff, so if you're interested, come in.

    Dart Summit 2018 Logo

    Instead of joining


    To get you up to speed, I’ll say that Wrike uses Dart, most likely, most actively in our part of the globe, and by the number of Dart code we wrote one hundredth of all world reserves. As Tim Sneath mentioned in his report, there are about 70 million lines of code on the github, our code is about 700k, so there is much to be proud of. But, of course, happiness is not in the lines. We are actively promoting the language, here infa in Russian there are two chats, well!
    And of course, Wrike moved a large crowd to the conference , despite the fact that this year it was held overseas in Los Angeles. Read about how it was a year ago in Munich here .

    * Note * : All conference reports are published and available inplaylist . I will not quote them verbatim.

    Main topics


    Again, a little context. Now Dart exists in several guises:


    This year, Google put a lot of effort into promoting Flutter, so two-thirds of the reports were about him. It is understandable, a new framework, new features, but more on that below.
    In addition to Flutter, another high-profile topic is Dart 2.0. And here I would like to learn more:

    Dart 2.0



    Why do we need Dart 2.0 if the first one did not take off?

    Good question, Mr. Hayter, the answer is simple: then . Then, if you look at the original idea, Dart should completely replace JavaScript, and from this it follows that Dart is “JIT compiled browser language with dynamic typing” . If you want, you typify. If you want, no. However, times are changing, and Dart is with them.
    School fun with dynamics comes time.
    Yes, the main idea of ​​Dart 2.0 is that it is a strongly typed language. Without any back and forth. The main changes can be expressed in three points:


    01. Strong Mode




    Here is more detailed . If you explain on the fingers: this language mode twists the typing to the maximum. Oh, how sometimes I want to write something like:

    void main() {
      List prices = ["99", "27", "10000", "200000"];
      //Sort prices from smallest to largest
      prices.sort();
      print("Lowest price is ${prices[0]}!");
    }

    But now it doesn’t work out, the analyzer will naturally swear:



    Many other examples can be found in the article above, I hope the basic idea is clear. We have built Strong Mode for a long time, and I must say that there are much fewer type-related errors.

    02. New Language Features


    Optional new and const
    Honestly, it's hard to call it features , but still, compare:

    
    // Dart 1
    Widget build(BuildContext context){
      return new Container(
        height: 56.0,
        padding: const EdgeInsets.symmetric(horizontal: 8.0), 
        decoration: new BoxDecoration(color: Colors.blue[500]),
        child: new Row(
          //...
        ),                              
      )
    }

    
    // Dart 2.0
    Widget build(BuildContext context){
      return Container(
        height: 56.0,
        padding: EdgeInsets.symmetric(horizontal: 8.0), 
        decoration: BoxDecoration(color: Colors.blue[500]),
        child: Row(
          //...
        ),                              
      )
    }

    Yes, it may not look like a breakthrough feature, but since the Flutter code is a bit like jsx, it’s quite convenient.

    02. New Common Front-End



    What’s the problem: many Dart tools are written by different teams, and this leads to inconsistency and additional work, since there is no reuse of the code. Therefore, in Dart 2.0 we are waiting for a new so-called "Frontend" - a set of common tools for the language.



    If we draw conclusions from the announcement of the second version, then Dart moves from a dynamic, JIT-oriented language to a strongly-typed, AOT-adapted language.

    Flutter


    What it is? This is a mobile framework that allows you to create mobile applications for two platforms (Android and iOS) simultaneously using Dart. In general, what are the main features of this framework? What options do mobile developers have to release an application for two platforms?

    • native customers. They work quickly, beautifully. But there’s twice as much code to write, two platforms
    • cross-platform clients. Good code reuse, just one command needed. But, fat BUT . The quality of cross-platform frameworks is poor. Examples, I think everyone knows

    But what about Kotlin, Dart is not needed,

    Hello again, Mr. Hayter. According to my feelings and in conversations with the team, Flutter is rather positioned as a framework for creating a View, which doesn’t interfere with writing business logic on something else. However, here I get on the junction of marketing and mobile development, and I am both like a pig in oranges, so ¯ \ _ (ツ) _ / ¯. But what can I say: the framework has a lot of good reviews. So, before you write that "fu, cross-platform" - try it. Perhaps this is just the tool that you were so lacking.

    A little bit about performance


    Of course, I would like to separately mention the inimitable Vyacheslav mraleph Egorov, who in his usual manner gave the most important advice on optimizing the performance of Dart.



    Here I recommend that you look at the full report , retelling such things is a sin.

    What about Angular?


    Well, despite the general bias towards mobile, our front-end brother had something to listen to. What new awaits us in Angular 5?

    • Error detection in templates with a new analyzer plugin
    • Improved work with child components due to getting rid of QueryList

      class ParentComponent {
        @ViewChildren(ChildComp)
        // было
        // QueryList children;
        List children;
      }
      

    • Improving Tree-Shaking. There used to be a problem that components and di-services were not removed from the code, even if they were not used. Now this problem is solved, and your client code will be optimized, just use

      
      bootstrapFactory(RootNgFactory)
      // и для di-сервисов
      @Injector.generate(...)
      

      Due to this, in the canonical test example, the gwt_mail_sample code became 52% less!
    • The dramatic acceleration of the assembly at the expense of a new package build_runner . Yes, everything is grown-up, incremental assembly, caching. If I could squeal like a schoolgirl , I would do so, this thing speeds up assembly to seconds!

    You can try all this now, just put yourself Dart 2.0 (on the poppy)

    brew install dart --devel

    and writing in my pubspec.yaml

    Something like this
    name: test_ng_five
    description: A web app that uses AngularDart
    version: 0.0.1
    #homepage: https://www.example.com
    #author: evgeny.gusev 
    environment:
      sdk: '2.0.0-dev.17.0'
    dependencies:
      angular: 5.0.0-alpha
    dev_dependencies:
      browser: ^0.10.0
      dart_to_js_script_rewriter: ^1.0.1
    transformers:
    - angular:
        entry_points:
          - web/main.dart
    - dart_to_js_script_rewriter
    


    Summary


    Dart will never become popular

    Oh, Mr. Hayter. As the conference showed, it is interesting to many people and continues to develop. So, firstly, the water wears away the stone, and the Dart community grows and grows stronger. And secondly, that’s not the point. Popularity is such a thing to itself: to do something just for the sake of it, usually ends badly. Therefore, I am glad that the language team has a goal, which is formulated very simply:



    Make Dart a Better Client Language


    PS


    Thanks to all friends, new and old. It was very nice to meet everyone again. Hello to the whole Wrike team, Sasha Doroshko from JetBrains, mraleph , zviad and all the Dartizans.
    You can find small notes on the conference on my twitter . Well, yes, I don’t know how they let me go on stage, but here's my lightning talk.


    Also popular now: