let's play dart

45
Let's play Dart! Jana Moudrá @Janamou +JanaMoudra www.moudra.net Juicymo #dfua

Upload: jana-moudra

Post on 20-Mar-2017

3.107 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Let's Play Dart

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

Juicymo

#dfua

Page 2: Let's Play Dart

Let's write a Web App...

Page 3: Let's Play Dart

No fairy tales today

Page 4: Let's Play Dart

What is Dart?

#dfua

Page 5: Let's Play Dart

Language

Easy to learn

Modular

Great tools

Page 6: Let's Play Dart

Language

Easy to learn

Modular

Great tools

Let's learn Dart in a few minutes

Page 7: Let's Play Dart

class Person {

String name;

int age;

Person(this.name, this.age);

}

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

Easy to learn

Page 8: Let's Play Dart

class Person {

var name;

var age;

Person(this.name, this.age);

}

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

Types are optional

Page 9: Let's Play Dart

var name; //is null

int count; //is null

Default value

no undefined in Dart

Page 10: Let's Play Dart

if (name is String) {

print("$name is String");

}

Checking types

Page 11: Let's Play Dart

Person person = new Person();

person.name = "Peter";

person.age = 18;

person.hairColor = "brown";

Normal developer life

Page 12: Let's Play Dart

Person person = new Person()

..name = "Peter"

..age = 18

..hairColor = "brown";

Hello .. operator

Page 13: Let's Play Dart

Me + Dart =

Productivity#dfua

Page 14: Let's Play Dart

Great docs

Tools and libraries

async/await

Null-Aware operators

Page 15: Let's Play Dart

pub

Page 16: Let's Play Dart

name: my_super_app

version: 0.1.0

description: My super application!

dependencies:

args: any

pubspec.yaml

Page 17: Let's Play Dart

name: my_super_app

version: 0.1.0

description: My super application!

dependencies:

args: any

pubspec.yaml

$ pub getResolving dependencies... Got dependencies!

Page 18: Let's Play Dart

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

Page 19: Let's Play Dart

HttpRequest

.getString("animals.json")

.then(feedAnimals);

Before async/await era

Page 20: Let's Play Dart

feedAnimals(await HttpRequest

.getString("animals.json"));

We can do it better

Page 21: Let's Play Dart

if (person != null) {

person.sayHello();

}

Null everywhere...

Page 22: Let's Play Dart

person?.sayHello();

Hello Null-Aware

Page 23: Let's Play Dart

person?.sayHello();

Hello Null-Aware

and that's not all...

Page 24: Let's Play Dart

Not only for

client side

#dfua

Page 25: Let's Play Dart

Not only for

client sideserver side command line mobile

#dfua

Page 26: Let's Play Dart

Client side

Web Browser

Compiles to JavaScript

Lots of libraries

Page 27: Let's Play Dart

Server side

Dart VM

Lots of frameworks

Integration with databases

App Engine, Firebase etc...

Page 28: Let's Play Dart

Command line

Page 29: Let's Play Dart

On mobile?

Page 30: Let's Play Dart

On mobile

Fletch

Flutter

Page 31: Let's Play Dart

Fletch

Flutter

dartlang.org/mobile flutter.io

On mobile

Page 32: Let's Play Dart

Developer

Utilities#dfua

Page 33: Let's Play Dart

Tests rule the world code

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

Person person = new Person("Jana");

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

});

Page 34: Let's Play Dart

Documentation for everything

/**

* [ProcessResult] represents the result of

* running a non-interactive process started with

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

*/

class ProcessResult {

Page 35: Let's Play Dart

Dartdoc

Page 36: Let's Play Dart

Observatory is your best friend

Profiling Dart code

Code coverage

Debugging memory leaks

...

Page 37: Let's Play Dart

Observatory

Page 38: Let's Play Dart

That's not all!

Stagehand

dartfmt

Grinder… and more on pub.dartlang.org

Page 39: Let's Play Dart

Why should I

use Dart?#dfua

Page 40: Let's Play Dart

#IJSAWTC

Page 41: Let's Play Dart

I Just Sit And

Write The Code!

Page 42: Let's Play Dart

I Just Sit And

Write The Code!for client for server for command line

Page 43: Let's Play Dart

Let's play Dart tomorrow

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

#dfua

Page 44: Let's Play Dart

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

Juicymo

Questions?

#dfua