Dart

[Pages:42]dart

#dart

Table of Contents

About

1

Chapter 1: Getting started with dart

2

Remarks

2

Links

2

Documentation

2

FAQ

3

Versions

3

Examples

5

Installation or Setup

5

Automated installation and updates

5

Manual install

5

Hello, World!

5

Http Request

6

Html

6

Dart

6

Example

6

Getters and Setters

6

Chapter 2: Asynchronous Programming

8

Examples

8

Returning a Future using a Completer

8

Async and Await

8

Converting callbacks to Futures

9

Chapter 3: Classes

10

Examples

10

Creating a class

10

Members

10

Constructors

11

Chapter 4: Collections

13

Examples

13

Creating a new List

13

Creating a new Set

13

Creating a new Map

13

Map each element in the collection.

14

Filter a list

14

Chapter 5: Comments

16

Syntax

16

Remarks

16

Examples

16

End of Line Comment

16

Multi-Line Comment

16

Documentation using Dartdoc

16

Chapter 6: Control Flow

18

Examples

18

If Else

18

While Loop

18

For Loop

19

Switch Case

19

Chapter 7: Converting Data

21

Examples

21

JSON

21

Chapter 8: Dart-JavaScript interoperability

22

Introduction

22

Examples

22

Calling a global function

22

Wrapping JavaScript classes/namespaces

22

Passing object literals

23

Chapter 9: Date and time

24

Examples

24

Basic usage of DateTime

24

Chapter 10: Enums

25

Examples

25

Basic usage

25

Chapter 11: Exceptions

26

Remarks

26

Examples

26

Custom exception

26

Chapter 12: Functions

27

Remarks

27

Examples

27

Functions with named parameters

27

Function scoping

27

Chapter 13: Libraries

29

Remarks

29

Examples

29

Using libraries

29

Libraries and visibility

29

Specifying a library prefix

30

Importing only part of a library

30

Lazily loading a library

30

Chapter 14: List Filters

32

Introduction

32

Examples

32

Filtering a list of integers

32

Chapter 15: Pub

33

Remarks

33

Examples

33

pub build

33

pub serve

33

Chapter 16: Regular Expressions

34

Syntax

34

Parameters

34

Remarks

34

Examples

34

Create and use a Regular Expression

34

Chapter 17: Strings

35

Examples

35

Concatenation and interpolation

35

Valid strings

35

Building from parts

35

Credits

37

About

You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: dart

It is an unofficial and free dart ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official dart.

The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.

Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to info@



1

Chapter 1: Getting started with dart

Remarks

Dart is an open-source, class-based, optionally-typed programming language for building web applications--on both the client and server--created by Google. Dart's design goals are:

? Create a structured yet flexible language for web programming. ? Make Dart feel familiar and natural to programmers and thus easy to learn. ? Ensure that Dart delivers high performance on all modern web browsers and environments

ranging from small handheld devices to server-side execution.

Dart targets a wide range of development scenarios, from a one-person project without much structure to a large-scale project needing formal types in the code to state programmer intent.

To support this wide range of projects, Dart provides the following features and tools:

? Optional types: this means you can start coding without types and add them later as needed.

? Isolates: concurrent programming on server and client ? Easy DOM access: using CSS selectors (the same way that jQuery does it) ? Dart IDE Tools: Dart plugins exist for many commonly used IDEs, Ex: WebStorm. ? Dartium: a build of the Chromium Web Browser with a built-in Dart Virtual Machine

Links

? The Dart Homepage ? Official Dart News & Updates ? The Dartosphere - A collection of recent Dart blog posts ? Dartisans Dartisans community on Google+ ? Dart Web Development - Google Groups Page ? Dart Language Misc - Google Groups Page ? DartLang sub-Reddit

Documentation

? Tour of the Dart Language ? Tour of the Dart Libraries ? Dart Code samples ? Dart API Reference



2

FAQ

? Frequently Asked Questions

Versions

Version 1.22.1 1.22.0 1.21.1 1.21.0 1.20.1 1.20.0 1.19.1 1.19.0 1.18.1 1.18.0 1.17.1 1.17.0 1.16.1 1.16.0 1.15.0 1.14.2 1.14.1 1.14.0 1.13.2 1.13.1 1.13.0

Release Date 2017-02-22 2017-02-14 2016-01-13 2016-12-07 2016-10-13 2016-10-11 2016-09-07 2016-08-26 2016-08-02 2016-07-27 2016-06-10 2016-06-06 2016-05-23 2016-04-26 2016-03-09 2016-02-09 2016-02-03 2016-01-28 2016-01-05 2015-12-17 2015-11-18



3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download