Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Dart: Up and Running
Foreword
Preface
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
1. Quick Start
Why Google Created Dart
A Quick Look at the Dart Language
What’s Cool About Dart
Up and Running
Step 1: Download and Install the Software
Step 2: Launch the Editor
Step 3: Create and Run an App
Step 4: Open and Run a Sample
What Next?
Become a power user
Send feedback!
2. A Tour of the Dart Language
A Basic Dart Program
Important Concepts
Runtime Modes
Variables
Default Value
Optional Types
Final and Const
Built-in Types
Numbers
Strings
Booleans
Lists
Maps
Functions
Optional Parameters
Optional named parameters
Optional positional parameters
Functions as First-Class Objects
Lexical Closures
Return Values
Operators
Arithmetic Operators
Equality and Relational Operators
Type Test Operators
Assignment Operators
Logical Operators
Bitwise and Shift Operators
Other Operators
Control Flow Statements
If and Else
For Loops
While and Do-While
Break and Continue
Switch and Case
Assert
Exceptions
Throw
Catch
Finally
Classes
Instance Variables
Constructors
Default constructors
Constructors aren’t inherited
Named constructors
Invoking a non-default superclass constructor
Initializer list
Redirecting constructors
Constant constructors
Factory constructors
Methods
Instance methods
Getters and setters
Abstract methods
Operators
Abstract Classes
Implicit Interfaces
Extending a Class
Class Variables and Methods
Static variables
Static methods
Generics
Why Use Generics?
Using Collection Literals
Using Constructors
Generic Collections and the Types they Contain
Libraries and Visibility
Using Libraries
Specifying a library prefix
Importing only part of a library
Implementing Libraries
Using multiple files
Declaring a library
Associating a file with a library
Re-exporting libraries
Isolates
Typedefs
Comments
Single-Line Comments
Multi-Line Comments
Documentation Comments
Summary
3. A Tour of the Dart Libraries
dart:core - Numbers, Collections, Strings, and More
Numbers
Strings and Regular Expressions
Searching inside a string
Extracting data from a string
Converting to uppercase or lowercase
Trimming and empty strings
Replacing part of a string
Building a string
Regular expressions
More information
Collections
Lists
Sets
Common collection methods
Maps
Dates and Times
Utility Classes
Comparing objects
Implementing map keys
Iteration
Asynchronous Programming
Chaining multiple asynchronous methods
Waiting for multiple futures
More information
Exceptions
dart:math - Math and Random
Trigonometry
Maximum and Mininum
Math Constants
Random Numbers
More Information
dart:html - Browser-Based Apps
Manipulating the DOM
Finding elements
Manipulating elements
Creating elements
Adding, replacing, and removing nodes
Manipulating CSS styles
Handling events
Using HTTP Resources with HttpRequest
Getting data from the server
Sending data to the server
Sending and Receiving Real-Time Data with WebSockets
Sending data
Receiving data
Handling WebSocket events
dart:isolate - Concurrency with Isolates
Isolate Concepts
Using Isolates
Spawning isolates
Sending messages
Sending any type of object
Receiving messages
Receiving replies
Keeping the root isolate alive
More Information
dart:io - I/O for Command-Line Apps
Files and Directories
Reading a file as text
Reading a file as binary
Handling errors
Streaming file contents
Writing file contents
Listing files in a directory
Other common functionality
HTTP Clients and Servers
HTTP server
HTTP client
dart:json - Encoding and Decoding Objects
Decoding JSON
Encoding JSON
dart:uri - Manipulating URIs
Encoding and Decoding Fully Qualified URIs
Encoding and Decoding URI Components
Parsing URIs
Building URIs
dart:utf - Strings and Unicode
Decoding UTF-8 Characters
Encoding Strings to UTF-8 Bytes
Other Functionality
dart:crypto - Hash Codes and More
Generating Cryptographic Hashes
Generating Message Authentication Codes
Generating Base64 Strings
Summary
4. Tools
pub: The Dart Package Manager
Creating a Pubspec
Installing Packages
Importing Libraries from Packages
More Information
Dart Editor
Viewing Samples
Managing the Files View
Adding apps
Removing apps
Creating Apps
Editing Apps
Using autocomplete
Browsing APIs
Finding where an API is declared
Outlining a file’s contents
Finding where an API is used
Refactoring
Searching
Running Apps
Specifying launch configurations
Running in production mode
Specifying a browser
Debugging Apps
Compiling to JavaScript
Other Features
Generating documentation with dartdoc
Customizing Dart Editor
Keyboard alternatives
Dartium: Chromium with the Dart VM
Downloading and Installing the Browser
Launching the Browser
Filing Bugs
Linking to Dart Source
Detecting Dart Support
Launching from the Command Line
dart2js: The Dart-to-JavaScript Compiler
Basic Usage
Options
dart: The Standalone VM
Basic Usage
Enabling Checked Mode
Additional Options
Summary
5. Walkthrough: Dart Chat
How to Run Dart Chat
How Dart Chat Works
The Client’s HTML Code
The Client’s Dart Code
Finding DOM Elements
Wrapping DOM Elements
Updating DOM Elements
Encoding and Decoding Messages
Communicating with WebSockets
The Server’s Code
Serving Static Files
Managing WebSocket Connections
Logging Messages to a File
What Next?
About the Authors
Copyright
← Prev
Back
Next →
← Prev
Back
Next →