Learning Dart
eBook: $35.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $95.98    Print cover: $59.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Develop apps for the Web using Dart and HTML5
  • Build powerful HTML5 forms, validate and store data in local storage, and use web components to build your own user interface
  • Make games by drawing and integrate audio and video in the browser
  • Learn how to develop an application with the help of a model-driven and fast-paced approach

Book Details

Language : English
Paperback : 388 pages [ 235mm x 191mm ]
Release Date : January 2014
ISBN : 1849697426
ISBN 13 : 9781849697422
Author(s) : Dzenan Ridjanovic, Ivo Balbaert
Topics and Technologies : All Books, Application Development, Web Development

Table of Contents

Chapter 1: Dart – A Modern Web Programming Language
Chapter 2: Getting to Work with Dart
Chapter 3: Structuring Code with Classes and Libraries
Chapter 4: Modeling Web Applications with Model Concepts and Dartlero
Chapter 5: Handling the DOM in a New Way
Chapter 6: Combining HTML5 Forms with Dart
Chapter 7: Building Games with HTML5 and Dart
Chapter 8: Developing Business Applications with Polymer Web Components
Chapter 9: Modeling More Complex Applications with Dartling
Chapter 10: MVC Web and UI Frameworks in Dart – An Overview
Chapter 11: Local Data and Client-Server Communication
Chapter 12: Data-driven Web Applications with MySQL and MongoDB
  • Chapter 1: Dart – A Modern Web Programming Language
    • What is Dart?
    • Dart is a perfect fit for HTML5
      • A very short history of web programming
      • Dart empowers the web client
      • JavaScript is not the way to go for complex apps
      • Google, GWT, and Dart
      • Advantages of Dart
    • Getting started with Dart
      • Installing the Dart Editor
        • Your first Dart program
    • Getting a view on the Dart tool chain
      • The Dart execution model
    • A bird's eye view on Dart
      • Example 1 – raising rabbits
        • Extracting a function
        • A web version
      • Example 2 – banking
    • Making a todo list with Dart
    • Summary
  • Chapter 2: Getting to Work with Dart
    • Variables – to type or not to type
    • Built-in types and their methods
      • Conversions
      • Operators
      • Some useful String methods
      • Dates and times
      • Lists
      • Maps
    • Documenting your programs
    • Changing the execution flow of a program
    • Using functions in Dart
      • Return types
      • Parameters
      • First class functions
    • Recognizing and catching errors and exceptions
      • Debugging exercise
    • Summary
  • Chapter 3: Structuring Code with Classes and Libraries
    • A touch of class – how to use classes and objects
      • Visibility – getters and setters
      • Types of constructors
        • Named constructors
        • factory constructors
        • const constructors
      • Inheritance
        • Abstract classes and methods
        • The interface of a class – implementing interfaces
      • Polymorphism and the dynamic nature of Dart
      • Collection types and generics
        • Typing collections and generics
        • The collection hierarchy and its functional nature
      • Structuring your code using libraries
        • Using a library in an app
        • Resolving name conflicts
        • Visibility of objects outside a library
      • Managing library dependencies with pub
      • Unit testing in Dart
      • Project – word frequency
    • Summary
  • Chapter 4: Modeling Web Applications with Model Concepts and Dartlero
    • A short introduction to Git and GitHub
      • Creating a repository on GitHub and a local version
      • Collaborating on a GitHub project
    • What a model is and why we need it in programming
    • Model concepts – a graphical design tool for our models
      • Working with model concepts
        • Explaining the model
        • Drawing the model
        • Exporting the model
        • What is JSON?
    • Dartlero – a simple domain model framework
    • An example of using Dartlero
    • The categories and links application
    • Summary
  • Chapter 5: Handling the DOM in a New Way
    • Finding elements and changing their attributes
      • Finding elements
      • Changing the attributes of elements
    • Creating and removing elements
    • Handling events
    • Manipulating the style of page elements
    • Animating a game
      • Ping Pong using style(s)
      • How to draw on a canvas – Ping Pong revisited
        • Spiral 1 – drawing a circle and a rectangle
        • Spiral 2 – colored circles and rectangles
        • Spiral 3 – moving a ball
        • Spiral 4 – reorganizing the code
        • Spiral 5 – a bouncing ball
        • Spiral 6 – displaying the racket
        • Spiral 7 – moving the racket using keys
        • Spiral 8 – moving the racket using the mouse
        • Spiral 9 – a real game
        • Spiral 10 – title and replay
        • Spiral 11 – the master version
    • Summary
  • Chapter 6: Combining HTML5 Forms with Dart
    • Spiral 1 – the power of HTML5 forms
    • Spiral 2 – how to validate data with Dart
      • Validation in the model
    • Spiral 3 – how to store data in local storage
    • Spiral 4 – reading and showing data
    • Spiral 5 – changing and updating data
    • Spiral 6 – working with a list of bank accounts
    • Summary
  • Chapter 7: Building Games with HTML5 and Dart
    • The model for the memory game
    • Spiral 1 – drawing the board
    • Spiral 2 – drawing cells
    • Spiral 3 – coloring the cells
    • Spiral 4 – implementing the rules
    • Spiral 5 – game logic (bringing in the time element)
    • Spiral 6 – some finishing touches
    • Spiral 7 – using images
    • Adding audio to a web page
    • Using an audio library – Collision clones
    • Adding video to a web page
    • Summary
  • Chapter 8: Developing Business Applications with Polymer Web Components
    • How web components change web development
    • Web components with Polymer.dart
      • Declaring and instantiating a web component
    • Two-way data binding in Polymer.dart
    • Creating the polymer_links project
      • Spiral s01
      • Spiral s02
      • Spiral s04
      • Spiral s05
      • Spiral s06
    • Using Polymer for the category links project
      • Adding local storage
    • Applying web components to the project tasks app
      • Add and remove Task propagations
    • Summary
  • Chapter 9: Modeling More Complex Applications with Dartling
    • The Dartling domain modeling framework
    • Design of the Travel Impressions model in spirals
    • Generating Travel Impressions code from the model
    • Initializing the Travel Impressions model with Data
    • Testing the Travel Impressions model
    • Defining and using the MVC pattern
    • The TodoMVC app
      • Spiral 0 – generating a class model
      • Spiral 1 – adding todo tasks
      • Spiral 2 – showing how many todo tasks left
      • Spiral 3 – removing a single task and completed tasks
      • Spiral 4 – editing todos (undo and redo)
      • Spiral 5 – displaying completed, remaining, or all todos
      • Spiral 6 – editing a task
    • Summary
  • Chapter 11: Local Data and Client-Server Communication
    • The options for browser storage
    • Asynchronous calls and Futures
    • Using IndexedDB with Dart
      • Spiral s00
      • Spiral s01
      • Spiral s02
      • Spiral s03
      • Spiral s04
      • Spiral s05
    • Using Lawndart
    • A Dart web server
    • Using JSON web services
      • Spiral s07
    • Summary

Dzenan Ridjanovic

Dzenan Ridjanovic is a university professor who is planning his early retirement to focus on the development of web applications with Dart, HTML5, web components, and NoSQL databases. For more than 10 years, he was a Director of Research and Development in the Silverrun team (http://www.silverrun.com/), which created several commercial tools for analysis, design, and development of data-driven applications. He was a principal developer of Modelibra (http://www.modelibra.org/) tools and frameworks for model-driven development in Java. Recently, he has been developing the Dartling framework for design and code generation of Dart models. His projects are at GitHub (https://github.com/dzenanr), where he is considered a Dart expert (http://osrc.dfm.io/dzenanr). He writes about his projects at On Dart blog (http://dzenanr.github.io/). His courses are available at On Dart Education (http://ondart.me/). He markets his Dart efforts at On Dart G+ Page (https://plus.google.com/+OndartMe). Dzenan Ridjanovic wrote a book in 2009, under the Creative Commons License, entitled Spiral Development of Dynamic Web Applications: Using Modelibra and Wicket (http://www.modelibra.org/).

Ivo Balbaert

Ivo Balbaert is currently a lecturer for (Web) Programming and Databases at CVO Antwerpen (www.cvoantwerpen.be), a community college in Belgium. He received a Ph.D. in Applied Physics from University of Antwerp in 1986. He worked for 20 years in the software industry as a developer and consultant in several companies, and for 10 years as a project manager at the University Hospital of Antwerp. From 2000 onward, he switched to partly teaching and partly developing software (KHM Mechelen, CVO Antwerp). He also wrote an introductory book in Dutch about developing in Ruby and Rails: Programmeren met Ruby en Rails, Van Duuren Media, ISBN: 978-90-5940-365-9, 2009, 420 p. In 2012, he authored a book on the Go programming language: The Way To Go, IUniverse, ISBN: 978-1-4697-6917-2, 600 p.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 3 submitted: last submission 12 May 2014

Page no: 20 | Errata type: Code


The given code is:

import 'dart:math'


It should be 

import 'dart:math';

Page no: 26 | Errata type: Code


The given code is:

query Selector ("#submit").onClick.listen( (e) => calcRabbits() );


It should be

querySelector ("#submit").onClick.listen( (e) => calcRabbits() );

Page no: 26 | Errata type: Technical


The given sentence is:

Here in lines (1) and (2), the input field and the output label are bound to the
variables in_years and output.


It should be:

Here in lines (1) and (2), the input field and the output label are bound to the
variables yearsInput and output.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Learning Dart +    Governance, Risk, and Compliance Handbook for Oracle Applications =
50% Off
the second eBook
Price for both: A$56.25

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Structure your code using functions, classes, generics, packages, and libraries
  • Model web applications with domain model frameworks
  • Use the power of modern browsers for processing and storing data
  • Build web games in HTML5 and code them in Dart
  • Get an overview of the available UI and MVC frameworks to use with Dart
  • Build the complex UI needed in business applications with Dart's Polymer framework based on web components
  • Store your data with MongoDB, one of the most popular NoSQL databases, and access your MongoDB databases from Dart

In Detail

Dart is a new open source programming language for the Web. Developed by Google, Dart is gaining popularity and has a steadily growing community. It is a single language for both client and server that can be used with a wide range of devices, including phones, tablets, laptops, and servers. It encompasses the lessons that have been learned over the last two decades of web programming. Stop solving new challenges with the same old tools - let Dart show you a whole new way.

"Learning Dart" provides you with a thorough overview of this new open source programming language. It will guide you step-by-step through building games and business applications for the Web, taking advantage of the power behind a modern language combined with HTML5.

"Learning Dart" starts by exploring the Dart ecosystem. This is followed by two chapters that will show you everything you need to know about Dart's syntax and development principles. Throughout the rest of the book, you will apply this knowledge to advanced topics with the help of an example-based approach.

You will explore how to build web games using HTML5, how to integrate audio and video into your applications, and how to process and show data in HTML5 forms with Dart. The book also shows you how web components fit together with HTML5 and how to apply them in business web applications. You also learn how to store data on the client, how to communicate data between client and server with JSON, and how to store JSON data with MongoDB.

"Learning Dart" provides you with everything you need to know to start or enhance your career in web development.


"Learning Dart" is a step-by-step guide that aims to give you hands-on knowledge about programming in Dart using an example-based approach.

Who this book is for

If you want to become a web developer, or perhaps you already are a web developer but you want to add Dart to your tool belt, then this book is for you. This book assumes that you have at least some knowledge of HTML and how web applications work. Some previous programming experience, preferably in a modern language like C#, Java, Python, Ruby, or JavaScript, will also give you a head start. You can also work with Dart on your preferred platform, be it Linux, Mac OS X, or Windows.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software