SlideShare a Scribd company logo
DISCOVER DART(LANG)
STÉPHANE ESTE-GRACIAS - 15/02/2017
DISCOVER DART(LANG)
THANKS TO
NYUKO.LU REYER.IO
INTRODUCTION
DISCOVER DART(LANG) - INTRODUCTION
DART LANGUAGE: ORIGINS
▸ Open Source Software under a BSD license
▸ Starting in October 2011
▸ Originally developed by Google
▸ Approved as a standard by Ecma in June 2014: ECMA-408
▸ Designed by Lars Bak and Kasper Lund
▸ Legacy developers of V8 Javascript Engine used in Chrome
DISCOVER DART(LANG) - INTRODUCTION
DART LANGUAGE: INFLUENCES
▸ Syntax: Javascript, Java, C#
▸ Object Model: Smalltalk
▸ Optional Types: Strongtalk
▸ Isolates: Erlang
▸ Compilation Strategy: Dart itself
▸ Dart sounds familiar to “mainstream” developers
DISCOVER DART(LANG) - INTRODUCTION
DART LANGUAGE: PURPOSES
▸ General-purpose and multi-platform programming language
▸ Easy to learn
▸ Easy to scale
▸ Deployable everywhere
▸ Web (Angular Dart), Mobile (Flutter), Server (VM)
▸ Command Line, IoT…
DISCOVER DART(LANG) - INTRODUCTION
DART LANGUAGE: ON PRODUCTION
▸ Google depends on Dart to make very large applications
▸ AdWords, AdSense, Internal CRM, Google Fiber…
▸ Over 2 million lines of production Dart code

Apps can reach hundreds of thousands of lines of code
▸ ReyeR has developed with Dart for 4 years now
▸ BikeMike.Mobi, Daanuu
DISCOVER DART(LANG) - INTRODUCTION
DART’S NOT JUST A LANGUAGE
▸ Well-crafted core libraries
▸ pub: a Package Manager
▸ Packages are available at pub.dartlang.org
▸ dartanalyzer: a static Analysis Tool for real-time analysis and code completion
▸ dartfmt: a source code reformatter for common coding conventions
▸ dartdoc: generate HTML documentation (triple slashes comments (///))
▸ dartium: a Web browser with Dart included (based on Chromium)
▸ …Unit test, Code Coverage, Profiling….
LANGUAGE
DISCOVER DART(LANG) - LANGUAGE
HELLO WORLD
void main() {

for (int i = 0; i < 5; i++) {

print('hello ${i + 1}');

}

}

$ dart hello_world.dart
hello 1
hello 2
hello 3
hello 4
hello 5
DISCOVER DART(LANG) - LANGUAGE
KEYWORDS
▸ class abstract final static implements extends with
▸ new factory get set this super operator
▸ null false true void const var dynamic typedef enum
▸ if else switch case do for in while assert
▸ return break continue
▸ try catch finally throw rethrow
▸ library part import export deferred default external
▸ async async* await yield sync* yield*
DISCOVER DART(LANG) - LANGUAGE
OPERATORS
▸ expr++ expr-- -expr !expr ~expr ++expr --expr
▸ () [] . ?. ..
▸ * / % ~/ + - << >> & ^ |
▸ >= > <= < as is is! == != && || ??
▸ expr1 ? expr2 : expr3
▸ = *= /= ~/= %= += -= <<= >>= &= ^= |= ??=
DISCOVER DART(LANG) - LANGUAGE
IMPORTANT CONCEPTS
▸ Everything is an object
▸ Even numbers, booleans, functions and null are objects
▸ Every object is an instance of a class that inherit from Object
▸ Everything is nullable
▸ null is the default value of every uninitialised object
▸ Static types are recommended for static checking by tools, but it’s optional
▸ If an identifier starts with an underscore (_), it’s private to its library
DISCOVER DART(LANG) - LANGUAGE
VARIABLES
var name = 'Bob';

var number = 42;



int number;

String string;

int number = 42;

String name = 'Bob';
DISCOVER DART(LANG) - LANGUAGE
FUNCTION: FAT ARROW
bool isNoble(int number) {

return _nobleGases[number] != null;

}
bool isNoble(int number) => _nobleGases[number] != null
=> expr syntax is a shorthand for { return expr; }
DISCOVER DART(LANG) - LANGUAGE
FUNCTION: OPTIONAL NAMED PARAMETERS
enableFlags({bool bold, bool hidden}) {

// ...

}



enableFlags(bold: true, hidden: false);
DISCOVER DART(LANG) - LANGUAGE
FUNCTION: OPTIONAL POSITIONAL PARAMETERS
String say(String from, String msg, [String device]) {

var result = '$from says $msg';

if (device != null) {

result = '$result with a $device';

}

return result;

}



assert(say('Bob', 'Howdy') == 'Bob says Howdy’);


assert(say('Bob', 'Howdy', 'phone') == 'Bob says Howdy with a phone');
DISCOVER DART(LANG) - LANGUAGE
CLASS / CONSTRUCTOR / NAMED CONSTRUCTORS
import 'dart:math';



class Point {

num x;

num y;



Point(this.x, this.y);
Point.fromJson(Map json) {

x = json['x'];

y = json['y'];

}
...
...



num distanceTo(Point other) {

var dx = x - other.x;

var dy = y - other.y;

return sqrt(dx * dx + dy * dy);

}

}
DISCOVER DART(LANG) - LANGUAGE
CASCADE NOTATION
var address = getAddress();

address.setStreet(“Elm”, “42”)

address.city = “Carthage”

address.state = “Eurasia”

address.zip(1234, extended: 5678);



getAddress()

..setStreet(“Elm”, “42”)

..city = “Carthage”

..state = “Eurasia”

..zip(1234, extended: 5678);
result = x ?? value;

// equivalent to

result = x == null ? value : x;
x ??= value;

// equivalent to

x = x == null ? value : x;
p?.y = 4;

// equivalent to

if (p != null) {

p.y = 4;

}
NULL AWARE OPERATORS
DISCOVER DART(LANG) - LANGUAGE
FUTURE & ASYNCHRONOUS
Future<String> lookUpVersion() async => '1.0.0';



Future<bool> checkVersion() async {

var version = await lookUpVersion();

return version == expected;

}




try {

server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4044);

} catch (e) {

// React to inability to bind to the port...

}
GETTING STARTED
DISCOVER DART(LANG) - GETTING STARTED
TRY DART ONLINE
▸ Online with DartPad https://dartpad.dartlang.org/

Supports only a few core libraries
DISCOVER DART(LANG) - GETTING STARTED
INSTALL DART ON YOUR FAVORITE PLATFORM
▸ Install Dart on MacOS, Linux Ubuntu/Debian, Windows
▸ Install an IDE
▸ Recommended: WebStorm or IntelliJ (for Flutter)
▸ Dart Plugins available for
▸ Atom, Sublime Text 3, Visual Studio Code, Emacs, Vim
DART VM
DISCOVER DART(LANG) - DART VM
CONSOLE APPLICATION; PUBSPEC.YAML
name: console

version: 0.0.1

description: A sample command-line application.

#author: someone <email@example.com>

#homepage: https://www.example.com



environment:

sdk: '>=1.0.0 <2.0.0'



dependencies:

foo_bar: '>=1.0.0 <2.0.0'



dev_dependencies:

test: '>=0.12.0 <0.13.0'
DISCOVER DART(LANG) - DART VM
CONSOLE APPLICATION; LIB/CONSOLE.DART
int calculate() {

return 6 * 7;

}

DISCOVER DART(LANG) - DART VM
CONSOLE APPLICATION; BIN/MAIN.DART
import 'package:console/console.dart' as console;



main(List<String> arguments) {

print('Hello world: ${console.calculate()}!');

}
$ dart bin/main.dart
Hello world: 42!
DISCOVER DART(LANG) - DART VM
CONSOLE APPLICATION; TEST/CONSOLE_TEST.DART
import 'package:console/console.dart';

import 'package:test/test.dart';



void main() {

test('calculate', () {

expect(calculate(), 42);

});

}

$ pub run test
00:00 +1: All tests passed!
DART WEBDEV
DISCOVER DART(LANG) - DART WEBDEV
SIMPLE WEB APPLICATION: PUBSPEC.YAML
name: 'web'

version: 0.0.1

description: An absolute bare-bones web app.

#author: someone <email@example.com>

#homepage: https://www.example.com



environment:

sdk: '>=1.0.0 <2.0.0'



#dependencies:

# my_dependency: any



dev_dependencies:

browser: '>=0.10.0 <0.11.0'

dart_to_js_script_rewriter: '^1.0.1'



transformers:

- dart_to_js_script_rewriter
DISCOVER DART(LANG) - DART WEBDEV
SIMPLE WEB APPLICATION: INDEX.HTML
<!DOCTYPE html>

<html>
<head>

...
<title>web</title>

<link rel="stylesheet" href="styles.css">

<script defer src=“main.dart"
type=“application/dart">
</script>

<script defer src=“packages/browser/dart.js">
</script>

</head>

<body>

<div id="output"></div>

</body>
</html>
DISCOVER DART(LANG) - DART WEBDEV
SIMPLE WEB APPLICATION: STYLES.CSS
@import url(https://fonts.googleapis.com/css?
family=Roboto);



html, body {

width: 100%;

height: 100%;

margin: 0;

padding: 0;

font-family: 'Roboto', sans-serif;

}
DISCOVER DART(LANG) - DART WEBDEV
SIMPLE WEB APPLICATION: MAIN.DART
import 'dart:html';



void main() {

querySelector(‘#output')
.text = 'Your Dart app is running.';

}
COMMUNITY
DISCOVER DART(LANG) - COMMUNITY
EVENTS
▸ Dart Events

https://events.dartlang.org
▸ Dart Developper Summit

https://events.dartlang.org/2016/summit/

https://www.youtube.com/playlist?list=PLOU2XLYxmsILKY-
A1kq4eHMcku3GMAyp2
▸ Meetup Luxembourg Dart Lang

https://www.meetup.com/Luxembourg-Dart-Lang-Meetup/
DISCOVER DART(LANG) - COMMUNITY
USEFUL LINKS
▸ Dart lang website https://www.dartlang.org
▸ Questions on StackOverflow http://stackoverflow.com/tags/dart
▸ Chat on Gitter https://gitter.im/dart-lang
▸ Learn from experts https://dart.academy/
▸ Source code on Github https://github.com/dart-lang
Q&A
Discover Dart - Meetup 15/02/2017

More Related Content

PDF
Discover Dart(lang) - Meetup 07/12/2016
Stéphane Este-Gracias
 
PDF
Dart on server - Meetup 18/05/2017
Stéphane Este-Gracias
 
PDF
AngularDart - Meetup 15/03/2017
Stéphane Este-Gracias
 
PPTX
Value protocols and codables
Florent Vilmart
 
PDF
Ethiopian multiplication in Perl6
Workhorse Computing
 
PDF
Perforce Object and Record Model
Perforce
 
PPTX
Linux networking
Arie Bregman
 
PDF
BSDM with BASH: Command Interpolation
Workhorse Computing
 
Discover Dart(lang) - Meetup 07/12/2016
Stéphane Este-Gracias
 
Dart on server - Meetup 18/05/2017
Stéphane Este-Gracias
 
AngularDart - Meetup 15/03/2017
Stéphane Este-Gracias
 
Value protocols and codables
Florent Vilmart
 
Ethiopian multiplication in Perl6
Workhorse Computing
 
Perforce Object and Record Model
Perforce
 
Linux networking
Arie Bregman
 
BSDM with BASH: Command Interpolation
Workhorse Computing
 

What's hot (17)

PPTX
Ansible for Beginners
Arie Bregman
 
PDF
Hypers and Gathers and Takes! Oh my!
Workhorse Computing
 
PPTX
(Practical) linux 104
Arie Bregman
 
PDF
Unleash your inner console cowboy
Kenneth Geisshirt
 
PDF
extending-php
tutorialsruby
 
PDF
COSCUP2012: How to write a bash script like the python?
Lloyd Huang
 
PDF
Beautiful Bash: Let's make reading and writing bash scripts fun again!
Aaron Zauner
 
PDF
BASH Guide Summary
Ohgyun Ahn
 
KEY
groovy & grails - lecture 4
Alexandre Masselot
 
PDF
Doing It Wrong with Puppet -
Puppet
 
PPTX
Bash Shell Scripting
Raghu nath
 
PPTX
(Practical) linux 101
Arie Bregman
 
PDF
Web Audio API + AngularJS
Chris Bateman
 
PDF
The $path to knowledge: What little it take to unit-test Perl.
Workhorse Computing
 
PPT
Bash shell
xylas121
 
PDF
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Carlo Sciolla
 
PPTX
Migrating to Puppet 4.0
Puppet
 
Ansible for Beginners
Arie Bregman
 
Hypers and Gathers and Takes! Oh my!
Workhorse Computing
 
(Practical) linux 104
Arie Bregman
 
Unleash your inner console cowboy
Kenneth Geisshirt
 
extending-php
tutorialsruby
 
COSCUP2012: How to write a bash script like the python?
Lloyd Huang
 
Beautiful Bash: Let's make reading and writing bash scripts fun again!
Aaron Zauner
 
BASH Guide Summary
Ohgyun Ahn
 
groovy & grails - lecture 4
Alexandre Masselot
 
Doing It Wrong with Puppet -
Puppet
 
Bash Shell Scripting
Raghu nath
 
(Practical) linux 101
Arie Bregman
 
Web Audio API + AngularJS
Chris Bateman
 
The $path to knowledge: What little it take to unit-test Perl.
Workhorse Computing
 
Bash shell
xylas121
 
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Carlo Sciolla
 
Migrating to Puppet 4.0
Puppet
 
Ad

Similar to Discover Dart - Meetup 15/02/2017 (20)

PPTX
Perl basics for Pentesters
Sanjeev Kumar Jaiswal
 
PPT
2007 09 10 Fzi Training Groovy Grails V Ws
loffenauer
 
PDF
Introduction to TypeScript
André Pitombeira
 
ODP
Whatsnew in-perl
daoswald
 
PPT
Bioinformatica 29-09-2011-p1-introduction
Prof. Wim Van Criekinge
 
PDF
Bash is not a second zone citizen programming language
René Ribaud
 
PDF
The Unbearable Lightness: Extending the Bash shell
Roberto Reale
 
PPTX
The GO Language : From Beginners to Gophers
I.I.S. G. Vallauri - Fossano
 
PPTX
Dart structured web apps
chrisbuckett
 
PPTX
Dart, unicorns and rainbows
chrisbuckett
 
PPT
Groovy Update - JavaPolis 2007
Guillaume Laforge
 
PDF
Groovy on the Shell
sascha_klein
 
PPTX
C# to python
Tess Ferrandez
 
PPTX
How Secure Are Docker Containers?
Ben Hall
 
PPTX
Laravel Day / Deploy
Simone Gentili
 
PDF
Ruby is an Acceptable Lisp
Astrails
 
PPT
Ruby for Perl Programmers
amiable_indian
 
PPT
name name2 n2
callroom
 
PPT
name name2 n
callroom
 
Perl basics for Pentesters
Sanjeev Kumar Jaiswal
 
2007 09 10 Fzi Training Groovy Grails V Ws
loffenauer
 
Introduction to TypeScript
André Pitombeira
 
Whatsnew in-perl
daoswald
 
Bioinformatica 29-09-2011-p1-introduction
Prof. Wim Van Criekinge
 
Bash is not a second zone citizen programming language
René Ribaud
 
The Unbearable Lightness: Extending the Bash shell
Roberto Reale
 
The GO Language : From Beginners to Gophers
I.I.S. G. Vallauri - Fossano
 
Dart structured web apps
chrisbuckett
 
Dart, unicorns and rainbows
chrisbuckett
 
Groovy Update - JavaPolis 2007
Guillaume Laforge
 
Groovy on the Shell
sascha_klein
 
C# to python
Tess Ferrandez
 
How Secure Are Docker Containers?
Ben Hall
 
Laravel Day / Deploy
Simone Gentili
 
Ruby is an Acceptable Lisp
Astrails
 
Ruby for Perl Programmers
amiable_indian
 
name name2 n2
callroom
 
name name2 n
callroom
 
Ad

More from Stéphane Este-Gracias (8)

PDF
HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
Stéphane Este-Gracias
 
PDF
20221130 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
PDF
20220928 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
PDF
20220202 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
PDF
20220608 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
PDF
Shift your Workspaces to the Cloud
Stéphane Este-Gracias
 
PDF
Discover Angular - Meetup 15/02/2017
Stéphane Este-Gracias
 
PDF
Discover Flutter - Meetup 07/12/2016
Stéphane Este-Gracias
 
HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
Stéphane Este-Gracias
 
20221130 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
20220928 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
20220202 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
20220608 - Luxembourg HUG Meetup
Stéphane Este-Gracias
 
Shift your Workspaces to the Cloud
Stéphane Este-Gracias
 
Discover Angular - Meetup 15/02/2017
Stéphane Este-Gracias
 
Discover Flutter - Meetup 07/12/2016
Stéphane Este-Gracias
 

Recently uploaded (20)

PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PPTX
Presentation about variables and constant.pptx
safalsingh810
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PDF
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
Presentation about variables and constant.pptx
safalsingh810
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 

Discover Dart - Meetup 15/02/2017

  • 4. DISCOVER DART(LANG) - INTRODUCTION DART LANGUAGE: ORIGINS ▸ Open Source Software under a BSD license ▸ Starting in October 2011 ▸ Originally developed by Google ▸ Approved as a standard by Ecma in June 2014: ECMA-408 ▸ Designed by Lars Bak and Kasper Lund ▸ Legacy developers of V8 Javascript Engine used in Chrome
  • 5. DISCOVER DART(LANG) - INTRODUCTION DART LANGUAGE: INFLUENCES ▸ Syntax: Javascript, Java, C# ▸ Object Model: Smalltalk ▸ Optional Types: Strongtalk ▸ Isolates: Erlang ▸ Compilation Strategy: Dart itself ▸ Dart sounds familiar to “mainstream” developers
  • 6. DISCOVER DART(LANG) - INTRODUCTION DART LANGUAGE: PURPOSES ▸ General-purpose and multi-platform programming language ▸ Easy to learn ▸ Easy to scale ▸ Deployable everywhere ▸ Web (Angular Dart), Mobile (Flutter), Server (VM) ▸ Command Line, IoT…
  • 7. DISCOVER DART(LANG) - INTRODUCTION DART LANGUAGE: ON PRODUCTION ▸ Google depends on Dart to make very large applications ▸ AdWords, AdSense, Internal CRM, Google Fiber… ▸ Over 2 million lines of production Dart code
 Apps can reach hundreds of thousands of lines of code ▸ ReyeR has developed with Dart for 4 years now ▸ BikeMike.Mobi, Daanuu
  • 8. DISCOVER DART(LANG) - INTRODUCTION DART’S NOT JUST A LANGUAGE ▸ Well-crafted core libraries ▸ pub: a Package Manager ▸ Packages are available at pub.dartlang.org ▸ dartanalyzer: a static Analysis Tool for real-time analysis and code completion ▸ dartfmt: a source code reformatter for common coding conventions ▸ dartdoc: generate HTML documentation (triple slashes comments (///)) ▸ dartium: a Web browser with Dart included (based on Chromium) ▸ …Unit test, Code Coverage, Profiling….
  • 10. DISCOVER DART(LANG) - LANGUAGE HELLO WORLD void main() {
 for (int i = 0; i < 5; i++) {
 print('hello ${i + 1}');
 }
 }
 $ dart hello_world.dart hello 1 hello 2 hello 3 hello 4 hello 5
  • 11. DISCOVER DART(LANG) - LANGUAGE KEYWORDS ▸ class abstract final static implements extends with ▸ new factory get set this super operator ▸ null false true void const var dynamic typedef enum ▸ if else switch case do for in while assert ▸ return break continue ▸ try catch finally throw rethrow ▸ library part import export deferred default external ▸ async async* await yield sync* yield*
  • 12. DISCOVER DART(LANG) - LANGUAGE OPERATORS ▸ expr++ expr-- -expr !expr ~expr ++expr --expr ▸ () [] . ?. .. ▸ * / % ~/ + - << >> & ^ | ▸ >= > <= < as is is! == != && || ?? ▸ expr1 ? expr2 : expr3 ▸ = *= /= ~/= %= += -= <<= >>= &= ^= |= ??=
  • 13. DISCOVER DART(LANG) - LANGUAGE IMPORTANT CONCEPTS ▸ Everything is an object ▸ Even numbers, booleans, functions and null are objects ▸ Every object is an instance of a class that inherit from Object ▸ Everything is nullable ▸ null is the default value of every uninitialised object ▸ Static types are recommended for static checking by tools, but it’s optional ▸ If an identifier starts with an underscore (_), it’s private to its library
  • 14. DISCOVER DART(LANG) - LANGUAGE VARIABLES var name = 'Bob';
 var number = 42;
 
 int number;
 String string;
 int number = 42;
 String name = 'Bob';
  • 15. DISCOVER DART(LANG) - LANGUAGE FUNCTION: FAT ARROW bool isNoble(int number) {
 return _nobleGases[number] != null;
 } bool isNoble(int number) => _nobleGases[number] != null => expr syntax is a shorthand for { return expr; }
  • 16. DISCOVER DART(LANG) - LANGUAGE FUNCTION: OPTIONAL NAMED PARAMETERS enableFlags({bool bold, bool hidden}) {
 // ...
 }
 
 enableFlags(bold: true, hidden: false);
  • 17. DISCOVER DART(LANG) - LANGUAGE FUNCTION: OPTIONAL POSITIONAL PARAMETERS String say(String from, String msg, [String device]) {
 var result = '$from says $msg';
 if (device != null) {
 result = '$result with a $device';
 }
 return result;
 }
 
 assert(say('Bob', 'Howdy') == 'Bob says Howdy’); 
 assert(say('Bob', 'Howdy', 'phone') == 'Bob says Howdy with a phone');
  • 18. DISCOVER DART(LANG) - LANGUAGE CLASS / CONSTRUCTOR / NAMED CONSTRUCTORS import 'dart:math';
 
 class Point {
 num x;
 num y;
 
 Point(this.x, this.y); Point.fromJson(Map json) {
 x = json['x'];
 y = json['y'];
 } ... ...
 
 num distanceTo(Point other) {
 var dx = x - other.x;
 var dy = y - other.y;
 return sqrt(dx * dx + dy * dy);
 }
 }
  • 19. DISCOVER DART(LANG) - LANGUAGE CASCADE NOTATION var address = getAddress();
 address.setStreet(“Elm”, “42”)
 address.city = “Carthage”
 address.state = “Eurasia”
 address.zip(1234, extended: 5678);
 
 getAddress()
 ..setStreet(“Elm”, “42”)
 ..city = “Carthage”
 ..state = “Eurasia”
 ..zip(1234, extended: 5678); result = x ?? value;
 // equivalent to
 result = x == null ? value : x; x ??= value;
 // equivalent to
 x = x == null ? value : x; p?.y = 4;
 // equivalent to
 if (p != null) {
 p.y = 4;
 } NULL AWARE OPERATORS
  • 20. DISCOVER DART(LANG) - LANGUAGE FUTURE & ASYNCHRONOUS Future<String> lookUpVersion() async => '1.0.0';
 
 Future<bool> checkVersion() async {
 var version = await lookUpVersion();
 return version == expected;
 } 
 
 try {
 server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4044);
 } catch (e) {
 // React to inability to bind to the port...
 }
  • 22. DISCOVER DART(LANG) - GETTING STARTED TRY DART ONLINE ▸ Online with DartPad https://dartpad.dartlang.org/
 Supports only a few core libraries
  • 23. DISCOVER DART(LANG) - GETTING STARTED INSTALL DART ON YOUR FAVORITE PLATFORM ▸ Install Dart on MacOS, Linux Ubuntu/Debian, Windows ▸ Install an IDE ▸ Recommended: WebStorm or IntelliJ (for Flutter) ▸ Dart Plugins available for ▸ Atom, Sublime Text 3, Visual Studio Code, Emacs, Vim
  • 25. DISCOVER DART(LANG) - DART VM CONSOLE APPLICATION; PUBSPEC.YAML name: console
 version: 0.0.1
 description: A sample command-line application.
 #author: someone <[email protected]>
 #homepage: https://www.example.com
 
 environment:
 sdk: '>=1.0.0 <2.0.0'
 
 dependencies:
 foo_bar: '>=1.0.0 <2.0.0'
 
 dev_dependencies:
 test: '>=0.12.0 <0.13.0'
  • 26. DISCOVER DART(LANG) - DART VM CONSOLE APPLICATION; LIB/CONSOLE.DART int calculate() {
 return 6 * 7;
 }

  • 27. DISCOVER DART(LANG) - DART VM CONSOLE APPLICATION; BIN/MAIN.DART import 'package:console/console.dart' as console;
 
 main(List<String> arguments) {
 print('Hello world: ${console.calculate()}!');
 } $ dart bin/main.dart Hello world: 42!
  • 28. DISCOVER DART(LANG) - DART VM CONSOLE APPLICATION; TEST/CONSOLE_TEST.DART import 'package:console/console.dart';
 import 'package:test/test.dart';
 
 void main() {
 test('calculate', () {
 expect(calculate(), 42);
 });
 }
 $ pub run test 00:00 +1: All tests passed!
  • 30. DISCOVER DART(LANG) - DART WEBDEV SIMPLE WEB APPLICATION: PUBSPEC.YAML name: 'web'
 version: 0.0.1
 description: An absolute bare-bones web app.
 #author: someone <[email protected]>
 #homepage: https://www.example.com
 
 environment:
 sdk: '>=1.0.0 <2.0.0'
 
 #dependencies:
 # my_dependency: any
 
 dev_dependencies:
 browser: '>=0.10.0 <0.11.0'
 dart_to_js_script_rewriter: '^1.0.1'
 
 transformers:
 - dart_to_js_script_rewriter
  • 31. DISCOVER DART(LANG) - DART WEBDEV SIMPLE WEB APPLICATION: INDEX.HTML <!DOCTYPE html>
 <html> <head>
 ... <title>web</title>
 <link rel="stylesheet" href="styles.css">
 <script defer src=“main.dart" type=“application/dart"> </script>
 <script defer src=“packages/browser/dart.js"> </script>
 </head>
 <body>
 <div id="output"></div>
 </body> </html>
  • 32. DISCOVER DART(LANG) - DART WEBDEV SIMPLE WEB APPLICATION: STYLES.CSS @import url(https://fonts.googleapis.com/css? family=Roboto);
 
 html, body {
 width: 100%;
 height: 100%;
 margin: 0;
 padding: 0;
 font-family: 'Roboto', sans-serif;
 }
  • 33. DISCOVER DART(LANG) - DART WEBDEV SIMPLE WEB APPLICATION: MAIN.DART import 'dart:html';
 
 void main() {
 querySelector(‘#output') .text = 'Your Dart app is running.';
 }
  • 35. DISCOVER DART(LANG) - COMMUNITY EVENTS ▸ Dart Events
 https://events.dartlang.org ▸ Dart Developper Summit
 https://events.dartlang.org/2016/summit/
 https://www.youtube.com/playlist?list=PLOU2XLYxmsILKY- A1kq4eHMcku3GMAyp2 ▸ Meetup Luxembourg Dart Lang
 https://www.meetup.com/Luxembourg-Dart-Lang-Meetup/
  • 36. DISCOVER DART(LANG) - COMMUNITY USEFUL LINKS ▸ Dart lang website https://www.dartlang.org ▸ Questions on StackOverflow http://stackoverflow.com/tags/dart ▸ Chat on Gitter https://gitter.im/dart-lang ▸ Learn from experts https://dart.academy/ ▸ Source code on Github https://github.com/dart-lang
  • 37. Q&A