let's play dart

Download Let's Play Dart

Post on 20-Mar-2017

3.095 views

Category:

Software

0 download

Embed Size (px)

TRANSCRIPT

  • Let's play Dart!Jana Moudr @Janamou +JanaMoudra www.moudra.net

    Juicymo

    #dfua

  • Let's write a Web App...

  • No fairy tales today

  • What is Dart?

    #dfua

  • Language

    Easy to learn

    Modular

    Great tools

  • Language

    Easy to learn

    Modular

    Great tools

    Let's learn Dart in a few minutes

  • class Person {

    String name;

    int age;

    Person(this.name, this.age);

    }

    Person person = new Person("Peter", 18);

    Easy to learn

  • class Person {

    var name;

    var age;

    Person(this.name, this.age);

    }

    var person = new Person("Peter", 18);

    Types are optional

  • var name; //is null

    int count; //is null

    Default value

    no undefined in Dart

  • if (name is String) {

    print("$name is String");

    }

    Checking types

  • Person person = new Person();

    person.name = "Peter";

    person.age = 18;

    person.hairColor = "brown";

    Normal developer life

  • Person person = new Person()

    ..name = "Peter"

    ..age = 18

    ..hairColor = "brown";

    Hello .. operator

  • Me + Dart =

    Productivity#dfua

  • Great docs

    Tools and libraries

    async/await

    Null-Aware operators

  • pub

  • name: my_super_app

    version: 0.1.0

    description: My super application!

    dependencies:

    args: any

    pubspec.yaml

  • name: my_super_app

    version: 0.1.0

    description: My super application!

    dependencies:

    args: any

    pubspec.yaml

    $ pub getResolving dependencies... Got dependencies!

  • dart:async, dart:collection, dart:convert, dart:core, dart:developer, dart:html, dart:indexed_db,

    dart:io, dart:isolate, dart:js, dart:math, dart:mirrors, dart:svg, dart:typed_data, dart:web_audio, dart:web_gl, dart:web_sql

  • HttpRequest

    .getString("animals.json")

    .then(feedAnimals);

    Before async/await era

  • feedAnimals(await HttpRequest

    .getString("animals.json"));

    We can do it better

  • if (person != null) {

    person.sayHello();

    }

    Null everywhere...

  • person?.sayHello();

    Hello Null-Aware

  • person?.sayHello();

    Hello Null-Aware

    and that's not all...

  • Not only for

    client side

    #dfua

  • Not only for

    client sideserver side command line mobile

    #dfua

  • Client side

    Web Browser

    Compiles to JavaScript

    Lots of libraries

  • Server side

    Dart VM

    Lots of frameworks

    Integration with databases

    App Engine, Firebase etc...

  • Command line

  • On mobile?

  • On mobile

    Fletch

    Flutter

  • Fletch

    Flutter

    dartlang.org/mobile flutter.io

    On mobile

  • Developer

    Utilities#dfua

  • Tests rule the world code

    Package testtest("Person is Jana", () {

    Person person = new Person("Jana");

    expect(person.name, equals("Jana"));

    });

  • Documentation for everything

    /**

    * [ProcessResult] represents the result of

    * running a non-interactive process started with

    * [Process.run] or [Process.runSync].

    */

    class ProcessResult {

  • Dartdoc

  • Observatory is your best friend

    Profiling Dart code

    Code coverage

    Debugging memory leaks

    ...

  • Observatory

  • That's not all!

    Stagehand

    dartfmt

    Grinder and more on pub.dartlang.org

  • Why should I

    use Dart?#dfua

  • #IJSAWTC

  • I Just Sit And

    Write The Code!

  • I Just Sit And

    Write The Code!for client for server for command line

  • Let's play Dart tomorrow

    Dart Code LabSat, 14:50 - 15:30, Community hall

    #dfua

  • Jana Moudr @Janamou +JanaMoudra www.moudra.net

    Juicymo

    Questions?

    #dfua

  • Image credits

    Matthew Keefe, cc, https://www.flickr.com/photos/60243770@N00/3123775954/

    Mari Wirta, cchttps://www.flickr.com/photos/64194626@N03/6292870807/

    jenny downing, cc, https://www.flickr.com/photos/7941044@N06/3990391143/

    Kjetil Korslien, cchttps://www.flickr.com/photos/kjetikor/8484119632/

    Krlis Dambrns, cchttps://www.flickr.com/photos/janitors/16524906898

    https://creativecommons.org/licenses/by/2.0/https://www.flickr.com/photos/60243770@N00/3123775954/https://creativecommons.org/licenses/by-nc-nd/2.0/https://www.flickr.com/photos/64194626@N03/6292870807/https://www.flickr.com/photos/64194626@N03/6292870807/https://creativecommons.org/licenses/by/2.0/https://www.flickr.com/photos/7941044@N06/3990391143/https://www.flickr.com/photos/7941044@N06/3990391143/https://www.flickr.com/photos/7941044@N06/3990391143/https://creativecommons.org/licenses/by-nc/2.0/https://www.flickr.com/photos/kjetikor/8484119632https://www.flickr.com/photos/janitors/https://creativecommons.org/licenses/by/2.0/https://www.flickr.com/photos/janitors/https://www.flickr.com/photos/janitors/16524906898