0%

Book Description

Design and build full-featured web and CLI apps using the powerful Dart language and its libraries and tools

In Detail

The Dart programming language can be used for both client- and server-side development. It combines the best from many of today's languages. Dart's cohesive, scalable, and robust web programming features will help individuals and organizations solve challenges in a whole new way.

You'll start off with an interactive tour of Dart and realize its power. You will step up to learn about the DOM tree and its implementation, while creating web apps. You will learn how to use various APIs for asynchronous calls, GeoLocation, Audio, File Drag and Drop, touch events, and more. Later on, you will build custom elements with Web Components and build on top of the previous parts with polymer.dart. You will also learn about data bindings and how to use AngularDart. You'll get to grips with writing CLI scripts, MySQL queries, Apache and nginx configuration, WebSockets, and so much more. Finally, you'll learn the unit testing and profiling, and writing native extensions in C/C++.

What You Will Learn

  • Learn about the Dart language syntax, libraries, and package manager
  • Use existing JavaScript libraries in Dart and call Dart code from JavaScript
  • Handle asynchronous calls with Future-Based API and use HTML5 features in Dart
  • Write example apps with Web Components and polymer.dart
  • Develop web apps using AngularDart
  • Test apps with unit tests and analyze them with Observatory
  • Explore CLI apps, WebSocket servers, and server-side scripting in Dart
  • Extend the Standalone Dart VM with C/C++ native extensions

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Dart Essentials
    1. Table of Contents
    2. Dart Essentials
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with Dart
      1. What is Dart?
      2. Why choose Dart?
      3. Installing the Dart SDK
        1. Dart Editor
        2. Writing a greeting for all Dartisans
          1. pubspec.yaml
          2. index.html
        3. The main() function
        4. Running and debugging code in Dartium
        5. Compiling Dart to JavaScript
      4. The Dart language tour
        1. The static checker
        2. Variables
        3. Built-in types
        4. Functions and parameters
          1. Class properties
          2. Class inheritance and abstract classes
          3. Constructors
        5. Exceptions
        6. Using static types
      5. Summary
    9. 2. Practical Dart
      1. Optimizing DOM tree manipulations
      2. The documentation search app
        1. The Future-Based API
        2. Using async and await keywords
          1. Async
          2. Await
        3. Creating Ajax requests in Dart
        4. Dart packages
        5. Writing the fuzzy search algorithm
        6. Handling HTML elements
      3. Combining Dart and JavaScript
        1. Using Dart in JavaScript
        2. Using JavaScript in Dart
      4. Dart MythBusters
      5. Summary
    10. 3. The Power of HTML5 with Dart
      1. Creating the Reddit Read Later app
        1. Fetching the JSONP data
        2. IndexedDB
          1. Initializing IndexedDB
          2. Fetching stored records
          3. Saving records
          4. Deleting records
          5. Indices
          6. Polishing the application
        3. LocalStorage versus IndexedDB
          1. What about WebSQL?
      2. Music visualizer
      3. Other noteworthy APIs and libraries
        1. Typed lists for fast numeric computing
          1. vector_math
          2. SIMD
        2. WebGL
          1. three.dart
        3. StageXL
        4. Box2D and play_phaser
        5. Isolates and Web Workers
      4. Summary
    11. 4. Developing a Mobile App with Dart
      1. 300 ms tap delay
      2. Basics of CSS3 transformations
        1. Axes
        2. Hello world in 3D
        3. Nesting 3D transformed elements
      3. A 3D bookshelf with DeviceOrientation events
      4. Position and distance tracker with the GeoLocation API and Google Maps API
      5. Drawing into 2D canvas using onTouch events
      6. Summary
    12. 5. Web Components and polymer.dart
      1. Web Components
        1. Shadow DOM
        2. Custom Elements
        3. Template
        4. HTML Imports
      2. The Web Components polyfill for older browsers
      3. Basic HTML Import
      4. Using Shadow DOM
      5. Using Custom Elements
      6. Polymer.dart
        1. Minimalistic custom element in polymer.dart
      7. One-way data binding
        1. Loops and conditions in templates
      8. Two-way data binding
      9. Polymer core and paper elements
        1. A quick look at core-list
        2. What's next?
      10. Summary
    13. 6. AngularDart
      1. Installing AngularDart
      2. To-do list with AngularDart
        1. Scope
      3. Extending the to-do list
        1. Model
        2. View
        3. Component
          1. Finishing TodoListComponent
        4. Data bindings
      4. A book component in AngularDart
      5. What is Angular 2.0?
        1. Why is Angular 2.0 not written in Dart?
      6. Performance tips for AngularDart
        1. Avoiding nesting ng-repeat directives
        2. Using track by for ng-repeat
        3. Avoiding excess formatter usage
        4. Not everything needs to be in Angular
      7. Summary
    14. 7. Server-side Applications with Dart
      1. The standalone Dart VM
      2. Parsing CLI arguments with the args package
      3. Writing a chat app with the WebSockets server
        1. Client-side WebSockets
        2. Listening to Unix signals and basic I/O operations
          1. Running the server as a background process
        3. Enumerated types
        4. Typedefs
        5. Using MySQL as a storage
      4. Writing an HTTP server with the route package
      5. Using Dart as a full-stack language
        1. Using Apache as a proxy for the Dart HTTP server
        2. Using nginx as a proxy for the Dart HTTP server
        3. Executing Dart as CGI and Apache mod_dart
      6. Summary
    15. 8. Testing and Profiling the Dart Code
      1. Testing strategies for web apps
      2. Unit testing
        1. Asynchronous tests
        2. Test groups
        3. Running all tests
      3. Operator overloading and mixins
        1. Operator overloading
        2. Mixins
      4. Testing AngularDart apps
      5. Profiling with the Observatory tool
      6. Summary
    16. 9. Writing Native Extensions for the Standalone Dart VM
      1. The structure of native extensions
      2. Writing a minimal native extension
      3. Writing a native fuzzy search implementation
        1. Optimizing our C/C++ code
        2. Multithreading with Dart Isolates
      4. Writing bindings for the exiv2 library
      5. Distributing native extensions
      6. Summary
    17. Index
3.14.131.212