Dart in Action

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
  1. Hello Dart
  2. "Hello World" with Dart tools
  3. Building and testing your own Dart app
  4. PART 2 CORE DART
  5. Functional first-class functions and closures
  6. Understanding libraries and privacy
  7. Constructing classes and interfaces
  8. Extending classes and interfaces
  9. Collections of richer classes
  10. Asynchronous programming with callbacks and futures
  11. PART 3 CLIENT-SIDE DART APPS
  12. Building a Dart web app
  13. Navigating offline data
  14. Communicating with other systems and languages
  15. PART 4 SERVER-SIDE DART
  16. Server interaction with files and HTTP
  17. Sending, syncing, and storing data
  18. Concurrency with isolates

.net [UK] (July 2015)

Java Coding Guidelines: 75 Recommendations for Reliable and Secure Programs

Twitter Bootstrap Web Development

Free Trade - Myth, Reality and Alternatives

.net [UK] (May 2015)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

private _isPacked property and the setter and getter, as shown next. Listing 3.7. Adding the isPacked property, getter, and setter Your final task is to add a click listener to the uiElement to perform the toggle between packed and not packed. The uiElement, as a

, can react to on.click events, so you need to add a click listener into the uiElement getter. The code in bold is the click listener itself, defined in function shorthand, which changes the isPacked value from true to

library with no top-level functions that consists only of classes.) You structure your code into libraries in order to let third-party code use packaged, abstracted functionality. When you use existing libraries, such as the dart:html library in chapter 3, you don’t need to know how it creates HTML elements and triggers browser events—only that it does. By building code into sensible libraries, you’re able to package and version them for others to use, providing a published interface to your

const keyword (instead of the new keyword), you can be sure that when you compare two instances that have the same field values, they’re considered identical. You can use this feature to determine whether a user has a specific permission. You need to create each of the permissions and assign it to a static variable in each class so you can refer to these variables throughout the application (static variables were also discussed in chapter 5). The following listing shows the boilerplate code to

returns an Iterator interface. The Iterator interface is used internally by the for (...in...) keywords, but you can use its hasNext and next() methods explicitly in your code to control when you move through a collection of items outside of an explicit loop. hasNext returns true if there’s another item to move to; next() returns the next item and moves the iterator pointer past the next item. If it has already returned the last item, it throws a StateError. The example in the following listing

return future values. The future value’s then(callback) callback function is called when the future has finally received a value. transform(callback) wraps its callback’s returned value in a new future. chain(callback) expects its callback’s returned value to be a future. The chain() and transform() callback functions are called when the future receives its value but also let you return another future. You can use these to build a sequence of multiple async and synchronous calls. In the

Download sample

Download