let's play dart

Post on 20-Mar-2017

3.107 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

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

top related