SlideShare uma empresa Scribd logo
1 de 38
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?
Lloyd Huang
 
BASH Guide Summary
BASH Guide SummaryBASH Guide Summary
BASH Guide Summary
Ohgyun Ahn
 
Bash shell
Bash shellBash shell
Bash shell
xylas121
 

Mais procurados (17)

Ansible for Beginners
Ansible for BeginnersAnsible for Beginners
Ansible for Beginners
 
Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!
 
(Practical) linux 104
(Practical) linux 104(Practical) linux 104
(Practical) linux 104
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
extending-php
extending-phpextending-php
extending-php
 
COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?
 
Beautiful Bash: Let's make reading and writing bash scripts fun again!
Beautiful Bash: Let's make reading and writing bash scripts fun again!Beautiful Bash: Let's make reading and writing bash scripts fun again!
Beautiful Bash: Let's make reading and writing bash scripts fun again!
 
BASH Guide Summary
BASH Guide SummaryBASH Guide Summary
BASH Guide Summary
 
groovy & grails - lecture 4
groovy & grails - lecture 4groovy & grails - lecture 4
groovy & grails - lecture 4
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
(Practical) linux 101
(Practical) linux 101(Practical) linux 101
(Practical) linux 101
 
Web Audio API + AngularJS
Web Audio API + AngularJSWeb Audio API + AngularJS
Web Audio API + AngularJS
 
The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.
 
Bash shell
Bash shellBash shell
Bash shell
 
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Alfresco the clojure way -- Slides from the Alfresco DevCon2011Alfresco the clojure way -- Slides from the Alfresco DevCon2011
Alfresco the clojure way -- Slides from the Alfresco DevCon2011
 
Migrating to Puppet 4.0
Migrating to Puppet 4.0Migrating to Puppet 4.0
Migrating to Puppet 4.0
 

Semelhante a Discover Dart - Meetup 15/02/2017

Semelhante a Discover Dart - Meetup 15/02/2017 (20)

Perl basics for Pentesters
Perl basics for PentestersPerl basics for Pentesters
Perl basics for Pentesters
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Whatsnew in-perl
Whatsnew in-perlWhatsnew in-perl
Whatsnew in-perl
 
Bioinformatica 29-09-2011-p1-introduction
Bioinformatica 29-09-2011-p1-introductionBioinformatica 29-09-2011-p1-introduction
Bioinformatica 29-09-2011-p1-introduction
 
Bash is not a second zone citizen programming language
Bash is not a second zone citizen programming languageBash is not a second zone citizen programming language
Bash is not a second zone citizen programming language
 
The Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shellThe Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shell
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
Dart
DartDart
Dart
 
Dart structured web apps
Dart   structured web appsDart   structured web apps
Dart structured web apps
 
Dart, unicorns and rainbows
Dart, unicorns and rainbowsDart, unicorns and rainbows
Dart, unicorns and rainbows
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Groovy on the Shell
Groovy on the ShellGroovy on the Shell
Groovy on the Shell
 
C# to python
C# to pythonC# to python
C# to python
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
Laravel Day / Deploy
Laravel Day / DeployLaravel Day / Deploy
Laravel Day / Deploy
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 
ppt7
ppt7ppt7
ppt7
 
ppt2
ppt2ppt2
ppt2
 
name name2 n
name name2 nname name2 n
name name2 n
 

Mais de Stéphane Este-Gracias

HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
Stéphane Este-Gracias
 

Mais de Stéphane Este-Gracias (8)

HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
HashiTalks France 2023 - Sécurisez la distribution automatique de vos certif...
 
20221130 - Luxembourg HUG Meetup
20221130 - Luxembourg HUG Meetup20221130 - Luxembourg HUG Meetup
20221130 - Luxembourg HUG Meetup
 
20220928 - Luxembourg HUG Meetup
20220928 - Luxembourg HUG Meetup20220928 - Luxembourg HUG Meetup
20220928 - Luxembourg HUG Meetup
 
20220202 - Luxembourg HUG Meetup
20220202 - Luxembourg HUG Meetup20220202 - Luxembourg HUG Meetup
20220202 - Luxembourg HUG Meetup
 
20220608 - Luxembourg HUG Meetup
20220608 - Luxembourg HUG Meetup20220608 - Luxembourg HUG Meetup
20220608 - Luxembourg HUG Meetup
 
Shift your Workspaces to the Cloud
Shift your Workspaces to the CloudShift your Workspaces to the Cloud
Shift your Workspaces to the Cloud
 
Discover Angular - Meetup 15/02/2017
Discover Angular - Meetup 15/02/2017Discover Angular - Meetup 15/02/2017
Discover Angular - Meetup 15/02/2017
 
Discover Flutter - Meetup 07/12/2016
Discover Flutter - Meetup 07/12/2016Discover Flutter - Meetup 07/12/2016
Discover Flutter - Meetup 07/12/2016
 

Último

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

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@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'
  • 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@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
  • 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