Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

It's only been a few years since the Dart programming language was born and it has become eminent and well-known not only within Google, but also in the wider community of developers. It has grown into a powerful tool to help developers produce efficient and consistent source code for web clients and standalone and server-side programs. The Dart development team and independent contributors have created some good documentation, so getting started with programming using Dart isn't that hard. You can program within different development environments such as the Eclipse-based Dart Editor; IDE plugins for IntelliJ IDEA and WebStorm; and text editor plugins for Sublime Text 3, Emacs, and Vim.

Actual development on Dart is quite similar to Java, C#, or any other object-oriented languages, so you can have your first short application up and running in a short amount of time. To go further, you can use the tutorials, code labs, and examples on the official Dart website (https://www.dartlang.org/). If you want to improve your level of expertise, you can read through the set of books on Dart that have been published in the last couple of years. You should always bear in mind that creating high-level, secure, and internationally compliant code is more complex than the application created in the beginning.

This book is designed to help you make the most effective use of the Dart programming language, its SDK libraries, and a rich set of publicly available packages. Feel free to refer to any chapter that you need to get more in-depth knowledge about. If you feel you have missed something major, go back and read the earlier chapters. The chapters in the book are arranged in such a way that you can easily learn more in a step by step manner.

I enjoy working with the Dart programming language and am really happy to share my enthusiasm and expertise with you to help you make use of the language in a more effective and comfortable manner.

What this book covers

Chapter 1, Beyond Dart's Basics, helps you take a step further to understand the concept of programming in the Dart language. It shows the best practices to use functions and closures and dives into the world of classes and mixins.

Chapter 2, Advanced Techniques and Reflection, lets you get a firm grasp on how to use generics, errors and exceptions, and annotations, and it takes you through Mirrors of reflection.

Chapter 3, Object Creation, helps you understand how objects can be created and will help you make a right choice that will be useful in different business cases.

Chapter 4, Asynchronous Programming, explores advanced technologies to organize asynchronous code execution. It shows you the best practices of Future, zones, and isolates.

Chapter 5, The Stream Framework, shows you how Dart manages streams. It teaches you how the single-subscription and broadcast streams can be used in different cases and scenarios.

Chapter 6, The Collection Framework, introduces you to the Dart collection frameworks. It shows which data structure of a collection is appropriate in specific cases based on patterns and performance consideration.

Chapter 7, Dart and JavaScript Interoperation, shows you how to use Dart and JavaScript together to build web applications. It lists problems and shows solutions you can use to communicate between Dart and JavaScript and the existing JavaScript program.

Chapter 8, Internalization and Localization, explains you how the i18n and l10n access can be embedded into your code to help you design and develop web applications that enable easy localization for different cultures, regions, and languages.

Chapter 9, Client-to-server Communication, helps you organize and create client-to-server communications. It has the answer on presumably the most important questions about the right choice of libraries and packages in specific scenarios.

Chapter 10, Advanced Storage, explains how can store data locally on a client, break the storage limits, and prevent security issues in your web applications. It will again touch upon cookies and demonstrate how to use Web Storage and the elaborate, more powerful, and more useful IndexedDB to store a large amount of data in the web browser.

Chapter 11, Supporting Other HTML5 Features, introduces you to different HTML5 features such as notifications, native drag-and-drop, geolocation, and canvas.

Chapter 12, Security Aspects, helps you understand the different aspects of security in web applications.

What you need for this book

Any modern PC installed with Windows, Linux, or Mac OS should be sufficient to run the code samples in the book. All the software used in the book is open source and freely available on the Web. The following are the links to the software:

Who this book is for

If you are a software engineer who has basic or intermediate knowledge of the Dart programming language and have possibly used this language to develop applications earlier, this is the book for you. The book reveals the different ways of developing client- and server-side applications on Dart and includes enough examples for both. For beginners, it will serve as a guide to rapidly accelerate from a novice level to the master level; for intermediate to advanced developers, it will quickly fill in the gaps on Dart.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The inst variable holds a reference to the original object in the reflectee property."

A block of code is set as follows:

// AssemblyLine.
class AssemblyLine {
  // List of items on line.
  List _items = [];

  // Add [item] to line.
  add(item) {
    _items.add(item);
  }

  // Make operation on all items in line.
  make(operation) {
    _items.forEach((item) {
      operation(item);
    });
  }
}

Any command-line input or output is written as follows:

sudo apt-get install libnss3-tools

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Expand the Web SQL tree item from the Resources tab to see the Web SQL storage data."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

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.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.