Tải bản đầy đủ (.pdf) (7 trang)

1449330894 dart 3505

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.34 MB, 7 trang )



Dart: Up and Running

Kathy Walrath and Seth Ladd


Dart: Up and Running
by Kathy Walrath and Seth Ladd
Copyright © 2013 Kathy Walrath, Seth Ladd. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (). For more information, contact our corporate/
institutional sales department: 800-998-9938 or

Editor: Meghan Blanchette
Production Editor: Christopher Hearse

Proofreader: Christopher Hearse
Cover Designer: Randy Comer
Interior Designer: David Futato
Illustrator: Rebecca Demarest

Revision History for the First Edition:
2012-10-24

First release

See for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly


Media, Inc. Dart: Up and Running, the image of a greater roadrunner, and related trade dress are trademarks
of O’Reilly Media, Inc.
This text of this work is available at this book’s GitHub project under the Creative Commons AttributionNoncommercial-No Derivative Works 3.0 United States License.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.

ISBN: 978-1-449-33089-7
[LSI]


Table of Contents

Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Quick Start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
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?

1

3
3
5
5
5
6
8
9

2. A Tour of the Dart Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
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

11
12
13
13

14
14
14
15
15
16
17
18
19
20
20
iii


Recall that in the root isolate, the _loggingPort variable holds a SendPort that the root
isolate uses to send messages to the logging isolate. Every time the chat server calls the
log() method, the root isolate sends the log data:
void log(String message) {
_loggingPort.send(message);
}

See “dart:isolate - Concurrency with Isolates” (page 76) for more information about
using isolates.

What Next?
You’ve seen how the Dart Chat sample uses both server-side and client-side Dart code
to implement a web app. Here are some other samples you might want to look at:
• Solar, which simulates the solar system with animations in a canvas, using
requestAnimationFrame().
• Spirodraw, a fun, interactive tool to build colorful works of art.

Finally, please visit our website and join the discussion. We look forward to hearing from
you!
• Dart website
• Dart discussion group
• Dart questions on Stack Overflow

What Next?

|

119


About the Authors
Kathy is a technical writer who’s worked on docs for Chrome and other developer APIs
at Google since 2006. Before that, she worked at Sun, NeXT, and HP. Back when the
Web was young, she wrote the first doc to help developers write Java applets. She also
co-created The Java Tutorial and maintained it for a very long time.
Seth is a Developer Advocate with the Chrome team. He is a conference organizer
(Aloha on Rails, New Game) and author (Expert Spring MVC [Apress]), helped publish
Angry Birds for the Web, and is a big fan of HTML5 and the modern Web.



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×