Dart Cookbook

Over 110 incredibly effective, useful, and hands-on recipes to design Dart web client and server applications

Dart Cookbook

This ebook is included in a Mapt subscription
Ivo Balbaert

1 customer reviews
Over 110 incredibly effective, useful, and hands-on recipes to design Dart web client and server applications
$10.00
$44.99
RRP $26.99
RRP $44.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781783989621
Paperback346 pages

Book Description

Dart is a new open source programming language for the Web, developed at Google, with a steadily growing community. It is a single language for both client and server, and is apt for the complete range of devices on the Web, including phones, tablets, laptops, and servers. Stop solving new challenges with the same old tools—let Dart show you a new, simpler, and more unified way, which makes use  of the same language for both client and server.

This book is a pragmatic guide that will increase your expertise in writing all kinds of applications, including web apps, scripts, and server-side apps. It provides rich insights on how to extend your Dart programming skills.

Table of Contents

Chapter 1: Working with Dart Tools
Introduction
Configuring the Dart environment
Setting up the checked and production modes
Rapid Dart Editor troubleshooting
Hosting your own private pub mirror
Using Sublime Text 2 as an IDE
Compiling your app to JavaScript
Debugging your app in JavaScript for Chrome
Using the command-line tools
Solving problems when pub get fails
Shrinking the size of your app
Making a system call
Using snapshotting
Getting information from the operating system
Chapter 2: Structuring, Testing, and Deploying an Application
Introduction
Exiting from an app
Parsing command-line arguments
Structuring an application
Using a library from within your app
Microtesting your code with assert
Unit testing a Polymer web app
Adding logging to your app
Documenting your app
Profiling and benchmarking your app
Publishing and deploying your app
Using different settings in the checked and production modes
Chapter 3: Working with Data Types
Introduction
Concatenating strings
Using regular expressions
Strings and Unicode
Using complex numbers
Creating an enum
Flattening a list
Generating a random number within a range
Getting a random element from a list
Working with dates and times
Improving performance in numerical computations
Using SIMD for enhanced performance
Chapter 4: Object Orientation
Introduction
Testing and converting types
Comparing two objects
Using a factory constructor
Building a singleton
Using reflection
Using mixins
Using annotations
Using the call method
Using noSuchMethod
Making toJSON and fromJSON methods in your class
Creating common classes for client and server apps
Chapter 5: Handling Web Applications
Introduction
Responsive design
Sanitizing HTML
Using a browser's local storage
Using application cache to work offline
Preventing an onSubmit event from reloading the page
Dynamically inserting rows in an HTML table
Using CORS headers
Using keyboard events
Enabling drag-and-drop
Enabling touch events
Creating a Chrome app
Structuring a game project
Using WebGL in your app
Authorizing OAuth2 to Google services
Talking with JavaScript
Using JavaScript libraries
Chapter 6: Working with Files and Streams
Introduction
Reading and processing a file line by line
Writing to a file
Searching in a file
Concatenating files
Downloading a file
Working with blobs
Transforming streams
Chapter 7: Working with Web Servers
Introduction
Creating a web server
Posting JSON-formatted data
Receiving data on the web server
Serving files with http_server
Using sockets
Using WebSockets
Using secure sockets and servers
Using a JSON web service
Chapter 8: Working with Futures, Tasks, and Isolates
Introduction
Writing a game loop
Error handling with Futures
Scheduling tasks using Futures
Running a recurring function
Using isolates in the Dart VM
Using isolates in web apps
Using multiple cores with isolates
Using the Worker Task framework
Chapter 9: Working with Databases
Introduction
Storing data locally with IndexedDB
Using Lawndart to write offline web apps
Storing data in MySQL
Storing data in PostgreSQL
Storing data in Oracle
Storing data in MongoDB
Storing data in RethinkDB
Chapter 10: Polymer Dart Recipes
Introduction
Data binding with polymer.dart
Binding and repeating over a list
Binding to a map
Using custom attributes and template conditionals
Binding to an input text field or a text area
Binding to a checkbox
Binding to radio buttons
Binding to a selected field
Event handling
Polymer elements with JavaScript interop
Extending DOM elements
Working with custom elements
Automatic node finding
Internationalizing a Polymer app
Chapter 11: Working with Angular Dart
Introduction
Setting up an Angular app
Using a controller
Using a component
Using formatters as filters
Creating a view
Using a service
Deploying your app

What You Will Learn

  • Set up your Dart environment to achieve the highest productivity
  • Structure, document, test, and deploy your apps
  • Use mixins, reflections, annotations, and other metadata programming techniques to create powerful apps
  • Use the power of modern browsers to process and store data
  • Communicate with JavaScript and use JavaScript libraries
  • Work with files, streams, and web servers by writing asynchronous code
  • Demonstrate the power of Polymer web components for binding data and structuring your web pages

Authors

Table of Contents

Chapter 1: Working with Dart Tools
Introduction
Configuring the Dart environment
Setting up the checked and production modes
Rapid Dart Editor troubleshooting
Hosting your own private pub mirror
Using Sublime Text 2 as an IDE
Compiling your app to JavaScript
Debugging your app in JavaScript for Chrome
Using the command-line tools
Solving problems when pub get fails
Shrinking the size of your app
Making a system call
Using snapshotting
Getting information from the operating system
Chapter 2: Structuring, Testing, and Deploying an Application
Introduction
Exiting from an app
Parsing command-line arguments
Structuring an application
Using a library from within your app
Microtesting your code with assert
Unit testing a Polymer web app
Adding logging to your app
Documenting your app
Profiling and benchmarking your app
Publishing and deploying your app
Using different settings in the checked and production modes
Chapter 3: Working with Data Types
Introduction
Concatenating strings
Using regular expressions
Strings and Unicode
Using complex numbers
Creating an enum
Flattening a list
Generating a random number within a range
Getting a random element from a list
Working with dates and times
Improving performance in numerical computations
Using SIMD for enhanced performance
Chapter 4: Object Orientation
Introduction
Testing and converting types
Comparing two objects
Using a factory constructor
Building a singleton
Using reflection
Using mixins
Using annotations
Using the call method
Using noSuchMethod
Making toJSON and fromJSON methods in your class
Creating common classes for client and server apps
Chapter 5: Handling Web Applications
Introduction
Responsive design
Sanitizing HTML
Using a browser's local storage
Using application cache to work offline
Preventing an onSubmit event from reloading the page
Dynamically inserting rows in an HTML table
Using CORS headers
Using keyboard events
Enabling drag-and-drop
Enabling touch events
Creating a Chrome app
Structuring a game project
Using WebGL in your app
Authorizing OAuth2 to Google services
Talking with JavaScript
Using JavaScript libraries
Chapter 6: Working with Files and Streams
Introduction
Reading and processing a file line by line
Writing to a file
Searching in a file
Concatenating files
Downloading a file
Working with blobs
Transforming streams
Chapter 7: Working with Web Servers
Introduction
Creating a web server
Posting JSON-formatted data
Receiving data on the web server
Serving files with http_server
Using sockets
Using WebSockets
Using secure sockets and servers
Using a JSON web service
Chapter 8: Working with Futures, Tasks, and Isolates
Introduction
Writing a game loop
Error handling with Futures
Scheduling tasks using Futures
Running a recurring function
Using isolates in the Dart VM
Using isolates in web apps
Using multiple cores with isolates
Using the Worker Task framework
Chapter 9: Working with Databases
Introduction
Storing data locally with IndexedDB
Using Lawndart to write offline web apps
Storing data in MySQL
Storing data in PostgreSQL
Storing data in Oracle
Storing data in MongoDB
Storing data in RethinkDB
Chapter 10: Polymer Dart Recipes
Introduction
Data binding with polymer.dart
Binding and repeating over a list
Binding to a map
Using custom attributes and template conditionals
Binding to an input text field or a text area
Binding to a checkbox
Binding to radio buttons
Binding to a selected field
Event handling
Polymer elements with JavaScript interop
Extending DOM elements
Working with custom elements
Automatic node finding
Internationalizing a Polymer app
Chapter 11: Working with Angular Dart
Introduction
Setting up an Angular app
Using a controller
Using a component
Using formatters as filters
Creating a view
Using a service
Deploying your app

Book Details

ISBN 139781783989621
Paperback346 pages
Read More
From 1 reviews

Read More Reviews