Dart Another tool in the toolbox
Dart Another tool
in the toolbox
http://blog.sethladd.com/2013/09/forms-http-servers-and-polymer-with-dart.html
Client and ServerWe got both kinds, Client and Server!!!
Who uses dart• Google - Fiber, Apps, Election
• Netflix - Security Monkey, integration with AWS
• Soundtrap - Music Recording with browser and WebRTC
• Blossom - Lean project mgmt tool
• SonarDesign - where Jesse works! :)
How do I use it?• Run in Chromium Browser with DartVM
• Compile to javascript
Language Features
Data types• Num (base abstract type):
• int double (concrete types for num)
• String
• Bool
• List - no arrays !!
• Map
Bool• Unlike JavaScript, 1 is not true
• True is true
• Everything else is false
Strongly typed / Optionally typed
Interpolation
Classes
Private, Getters/Setters
Constructor
Methods - Positional Parameters• optional parameters specified with [ ]
• defaults with =
Methods - Named Parameters• named parameters specified with {}
• defaults with :
name (x) => expression
Shorthand function
Anonymous Function
FYI: fold is like inject/reduce in ruby
Use the shorthand syntax
Generics
Mixins
Functional
http://www.infoq.com/presentations/dart-introduction
Interfaces• Not strict, only warnings if you don't implement
all the methods
Dart VM Modes
• Checked - annotations (int, string, etc) throw exceptions if given invalid data
• Production - type annotations are ignored
Console Apps• import "dart:io"
• Can't use in web pages
• File operations
• synchronous
• asynchronous
Web Applications
demo