Write Web Apps with Dart: Develop and Design

Book description

DART, THE OPEN-SOURCE web programming language developed by Google, is designed for building everything from simple console utilities to full-featured applications for browsers and mobile devices. The Dart language is both familiar for seasoned engineers and easy to learn for aspiring programmers.

To get you up and productive, Dart developer Jack Murphy presents a series of solutions that a modern full stack developer will need to become proficient and launch a production application using Dart. In addition to a language introduction and overview, Jack builds a web application that will provide an easy-to-follow walkthrough of the Dart language and its associated development environments for both front-end and back-end programming. Jack’s web application implements a series of asynchronous browser components using Angular 2 Dart, while also leveraging Dart’s server capabilities to create a Dart-powered REST API.

THIS BOOK INCLUDES:

  • Detailed instruction, ample illustrations, and clear examples

  • Real-world guidance and advice

  • Insight into best practices from a Dart developer

  • CORRESPONDING GITHUB PROJECT (https://github.com/rightisleft/web_apps_dart) is included so that you can follow along with the examples in the video.

    Two additional chapters with up-to-date material on the Angular 2 framework are available at www.peachpit.com.

    Table of contents

    1. Title Page
    2. Copyright Page
    3. Dedication Page
    4. Acknowledgments
    5. Author Bio
    6. Contents
    7. Introduction
      1. Who Is This Book For?
      2. How to Use This Book
      3. Online Content
      4. Code Examples
      5. Welcome to Dart
        1. The Technologies
    8. Part I: The Dart Language and Ecosystem
      1. Chapter 1. Dart and the History of Browser Languages
        1. The Web and Open Standards
        2. JavaScript Deficits
        3. Modern Alternatives
        4. ECMAScript 4
        5. Dash Memo
        6. Google’s Market Strategy
          1. Dart2JS
          2. Dart Dev Compiler
          3. Dart Virtual Machine
          4. Dart Virtual Machine Strategy
          5. How Is the Dart Language Different?
          6. A New ECMA Standard
        7. Summary
          1. You should Know:
      2. Chapter 2. Up and Running with Dart
        1. Installing the Dart SDK
          1. What’s in the dart-sdk
        2. Dart Environmental Variables
          1. Windows 8
          2. Mac OS X 10.10
          3. Ubuntu 14.10
        3. IntelliJ IDEA Editor
          1. Installing IDEA for Dart
          2. Running Dart
          3. Line Numbers
          4. Dart Command Line Debugger
          5. Dart in WebStorm and Others
        4. Optional Homebrew
        5. Summary
          1. You should know:
      3. Chapter 3. Introduction to the Dart Language
        1. Creating Your First Dart Project
        2. Using Functions in Dart
          1. Application Entry Point and main()
          2. Functions and Optional Return Types
          3. First-class Functions
          4. Function Reference and Function Values
          5. Function Parameters
          6. Primitives
          7. Primitives Passed as Values
        3. Dart Objects and Maps
          1. Accessing Properties of a Map
          2. Determining Object Equality
        4. Statements and Control Structures
          1. Conditionals with if-then-else
          2. Iteration Using for Loops
          3. While Loops
          4. Controlling Loops
          5. switch and case
        5. Errors on assert()
        6. Collections and Iterators
          1. List
          2. Queue
          3. Set
        7. Numbers
          1. int
          2. double
          3. Typed Numeric List
          4. Enums
          5. Exceptions
        8. Summary
          1. You should know:
      4. Chapter 4. Object Structures in Dart
        1. Variables
        2. Lexical Scope
        3. Classes
          1. Custom Classes
          2. Inferred Namespace
        4. Class Constructors
          1. Generative Constructor
          2. Automatic Class Member Variable Initialization
          3. Named Constructors
          4. Factory Constructors
          5. Static Variables
          6. Final Variables
        5. Constants
          1. Constant Objects
          2. Constant Identifiers
          3. Constant Constructors
        6. Class Inheritance
          1. Abstract Classes
        7. Polymorphism
        8. Abstract Methods
        9. Super Constructors
          1. Implicit super
          2. Explicit super()
        10. Interfaces
        11. Mixins
        12. Summary
          1. You should Now Know:
      5. Chapter 5. Packages and Libraries
        1. Your First Library
          1. Library
          2. Import
          3. Hide and Show
        2. Visibility and Privacy
        3. part and part of
        4. Packages and pubspec.yaml
        5. Named Package Imports
        6. Summary
          1. You should Now Know:
      6. Chapter 6. Event Loops and Asynchronous Programming
        1. Concurrent Computing Paradigm
        2. Futures, Completers, and Streams
          1. Synchronous Requests
          2. Futures
          3. Futures and Completers
        3. Streams
        4. Event Loop
        5. Async
          1. Await
        6. Summary
          1. You should Now Know:
    9. Part II: Full-Stack App Development with Dart
      1. Chapter 7. Planning the Application
        1. Fictitious Company Background
        2. Feature Requests
        3. Data Entities
          1. Routes
          2. Times
          3. Cities
          4. Purchases
          5. Transactions
        4. Architecture Choices
        5. Summary
          1. You Should Now Know:
      2. Chapter 8. Introduction to MongoDB
        1. Relational vs. NoSQL Databases
        2. Why Not Database X?
        3. What Is MongoDB?
        4. Installing MongoDB
          1. Mac OS X
          2. Windows
        5. The Mongo Client
          1. Interacting with a Mongo Database
          2. Embedding Documents
        6. Summary
          1. You should now know:
      3. Chapter 9. Mongo Dart
        1. Setting Up Your Project
        2. Downloading and Installing Mongo Dart Packages
        3. Exposing Database Credentials
        4. Seeding Data in Dart
          1. Collections
          2. Documents
        5. Reading a File from the File System
        6. Converting to JSON
        7. Connecting to Mongo from Dart
        8. Verifying the Data
        9. Summary
          1. You Should Now Know:
      4. Chapter 10. Data Modeling Using Dartson
        1. Why Dartson
        2. Mongo Pooling
        3. Dartson Serialization
        4. Creating a MongoModel with CRUD
          1. Interface Methods
          2. Connect to Mongo
          3. Create
          4. Delete
          5. Update
          6. Read
          7. Drop
        5. Summary
          1. You Should Now Know:
      5. Chapter 11. Webserver and Middleware
        1. Shelf
        2. Setting Up a Shelf Example
        3. Adding Middleware
        4. Adding Routing
        5. Serving Static Assets
        6. Using Multiple Handlers
          1. Setting Up and Building Your Web Folder
          2. Calling Static Assets and Querying the API
        7. Summary
          1. You Should Now Know:
      6. Chapter 12. API Routing, Requests, and Responses
        1. Modeling Your Ticketing Domain
          1. Using a Consistent Method Signature
          2. Getting Collections of Data
          3. Creating Multiple Asynchronous Writes
          4. Nesting DTOs
        2. Implementing Controllers
          1. Path Parameters
          2. Post Parameters
          3. Response Objects
          4. Generic JSON Handler
          5. Wire Up the Remaining APIs
        3. Handling Routes
          1. Testing Routes
        4. Summary
          1. You Should Now Know:
      7. Chapter 13. Unit Testing Your Code
        1. What Is Unit Testing?
        2. Jasmine via Guinness
        3. Setting Up Guinness
        4. Composition of a Guinness Test
        5. Testing Mongo
          1. Seeder Spec
          2. Specs and Futures
          3. Specs and Async
          4. Read Spec
          5. Delete Spec
          6. Drop Database Spec
          7. Additional Tests
        6. Summary
          1. You Should Now Know:
      8. Chapter 14. A Web Project with Dart
        1. Planning for Front-End Development
          1. Development Tools
          2. Development Libraries
        2. Interacting with HTML and the DOM
        3. Querying the DOM
          1. DOM
          2. HTML
          3. Tags and Attributes
          4. Selectors
        4. Building the Landing Page
          1. Create the Box Template
          2. Programmatically Instantiate Elements
          3. Render the Deals Data
          4. Render the View
        5. Summary
          1. You Should Now Know:
      9. Chapter 15. Introduction to Angular 2 Dart
        1. The History of AngularJS and Angular Dart
        2. TypeScript
        3. Developer Preview Warning
        4. Angular 2 Overview
          1. Components
          2. Data Binding
          3. Dependency Injection
          4. Directives
        5. Summary
          1. You Should Now Know:
        6. Congratulations!
    10. Index
    11. Code Snippets

    Product information

    • Title: Write Web Apps with Dart: Develop and Design
    • Author(s):
    • Release date: December 2015
    • Publisher(s): Peachpit Press
    • ISBN: 9780134214290