Learning Dart(Second Edition)
上QQ阅读APP看书,第一时间看更新

What this book covers

Learning Dart, Second Edition, has 11 chapters. It begins with the basic elements of Dart and ends with a client/server application that uses MongoDB (http://www.mongodb.org/) for data persistence on the server-side.

Chapter 1, Dart – A Modern Web Programming Language, will help you understand what Dart is all about. Dart is presented as a major step forward in the web programming arena.

Chapter 2, Getting to Work with Dart, will help you get a firm grasp on how to program in Dart. The code and data structures in Dart and its functional principles are explained by exploring practical examples.

Chapter 3, Structuring Code with Classes and Libraries, will make you understand how to use Dart classes to organize code. Dart libraries will be introduced to show how complex software may be packaged.

Chapter 4, Modeling Web Applications with Model Concepts and Dartlero, will let you design graphically a small model in the Model Concepts tool, which is developed in Dart. A model is then represented in Dart as several classes that inherit some data and operations from the classes of the Dartlero model framework; this is also done in Dart.

Chapter 5, Handling DOM in a New Way, covers how to access HTML elements in Dart. Some elements will be even created in Dart and placed properly in the Document Object Model (DOM) of a web page. Dart will also handle user events, such as a click on a button. Finally, you will be able to create a simple game in Dart.

Chapter 6, Combining HTML5 Forms with Dart, will let you enter some data in a form. The data will be validated by HTML5 and Dart. Then, the valid data will be saved in the local storage of a browser.

Chapter 7, Building Games with HTML5 and Dart, will let you create a well-known memory game step by step, based on what you have learned already. Each step will be a new spiral represented as a complete project in Dart Editor. The first spiral will draw only a rectangle, while the last spiral will be a game that you may show to your friends.

Chapter 8, Developing Business Applications with Polymer Web Components, will help you create several web components using Polymer.dart. These web components will be used in the different sections of a single-page application. Three different projects with web components will be presented in this chapter.

Chapter 9, Modeling More Complex Applications with dartling, will let you discover how a graphical model can be transformed into a JSON document and then used to generate a complete model in Dart by using the dartling domain model framework together with its tools. The dartling follows the Model View Controller (MVC) pattern to separate a model from its views.

Chapter 10, Local Data and Client-Server Communication, will let you store application data in a local database called IndexedDB. The data will then be sent as a JSON document to a Dart server. Asynchronous programming with futures will be covered in this chapter.

Chapter 11, Data-Driven Web Applications with MySQL and MongoDB, will help you learn how to use database drivers to save (and load) data to (and from) a relational database and a NoSQL database. Data sent from a browser as a JSON document will be easily saved in MongoDB in the same JSON form. Two clients will exchange data with the server so that both of them will be up-to-date.

For this second edition, all the code and projects were updated to Dart version 1.11. Moreover, sections on the following topics were added:

  • enums
  • Async and await
  • The Observatory tool
  • Running a Dart server on an App Engine Managed VM