Dart in Action
Chris Buckett
Language: English
Pages: 424
ISBN: 1617290866
Format: PDF / Kindle (mobi) / ePub
Summary
Dart in Action introduces Google's Dart language and provides techniques and examples showing how to use it as a viable replacement for Java and JavaScript in browser-based desktop and mobile applications. It begins with a rapid overview of Dart language and tools, including features like interacting with the browser, optional typing, classes, libraries, and concurrency with isolates. After you master the core concepts, you'll move on to running Dart on the server and creating single page HTML5 web applications.
About the Technology
Dart is a web programming language developed by Google. It has modern OO features, just like Java or C#, while keeping JavaScript's dynamic and functional characteristics. Dart applications are "transpiled" to JavaScript, and they run natively in Dart-enabled browsers. With production-quality libraries and tools, Dart operates on both the client and the server for a consistent development process.
About this Book
Dart in Action introduces the Dart language and teaches you to use it in browser-based, desktop, and mobile applications. Not just a language tutorial, this book gets quickly into the nitty-gritty of using Dart. Most questions that pop up while you're reading are answered on the spot! OO newbies will appreciate the gentle pace in the early chapters. Later chapters take a test-first approach and encourage you to try Dart hands-on.
To benefit from this book you'll need experience with HTML and JavaScript?a Java or C# background is helpful but not required.
Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
What's Inside
- Dart from the ground up
- Numerous code samples and diagrams
- Creating single-page web apps
- Transitioning from Java, C#, or JavaScript
- Running Dart in the browser and on the server
About the Author
Chris Buckett builds enterprise-scale web applications. He runs Dartwatch.com and is an active contributor to the dartlang list.
"Includes numerous examples of core language features as well as more advanced HTML5 features."-;From the Foreword by Seth Ladd, Developer Advocate, Google
Table of Contents
PART 1 INTRODUCING DART
- Hello Dart
- "Hello World" with Dart tools
- Building and testing your own Dart app
- Functional first-class functions and closures
- Understanding libraries and privacy
- Constructing classes and interfaces
- Extending classes and interfaces
- Collections of richer classes
- Asynchronous programming with callbacks and futures
- Building a Dart web app
- Navigating offline data
- Communicating with other systems and languages
- Server interaction with files and HTTP
- Sending, syncing, and storing data
- Concurrency with isolates
PART 2 CORE DART
PART 3 CLIENT-SIDE DART APPS
PART 4 SERVER-SIDE DART
Android Apps for Absolute Beginners (2nd Edition)
Sams Teach Yourself the Twitter API in 24 Hours
Regular Expressions Cookbook (2nd Edition)
Pro Website Development and Operations: Streamlining DevOps for large-scale websites
this practice is that when you’re designing a library, it’s good practice to provide interfaces in type definitions to allow the most flexibility to users of your library. Often, though, you intend the users of your library to use a specific class in most circumstances. The AuthService abstract class, which defines the interface, is a good example. Most of the time, users use the AuthService interface type in conjunction with the EnterpriseAuthService class that’s part of the same external
list of anything “is-a” List, but how does Dart achieve this when no type is specified? Behind the scenes, using an untyped generic is the same as using the dynamic type. The dynamic type, which we discussed in chapter 7, represents the untyped version of every class, and every instance of a class “is-a” dynamic. Thus, all lists of any type or no type are also always lists of dynamic: One final question arises, specifically with literal lists, because they have a specific syntax that Dart
serialized string to send the Role data over the web (which we’ll explore in part 3, later in the book). Remember Use the operator keyword in conjunction with the operator symbol to provide a new method in your class to overload the operator. Ensure that you overload operators only where doing so will aid readability of the code. You can overload indexer operators to allow map-like access to properties of your class. The dart:json library can convert classes that implement the Map
handler functions of the same element. You can add a second handler to the button: button.on.click.add( (event) => print("second event handler")); Although the event-handler function on the actions
for you. The postMessage(data, targetOrigin) function provided by the browser takes two parameters: the data, which you’re sending as JSON, and targetOrigin, which is the URL from which the receiving page was served. This means if you’re sending data to http://localhost:8080/DartExpense.html, the target origin is also http://localhost:8080/DartExpense.html. In most cases, you can use the value of window.location.href, because you’re sending messages in the same page, but being able to change