Book Image

Learning Dart, Second Edition - Second Edition

By : Ivo Balbaert
Book Image

Learning Dart, Second Edition - Second Edition

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Learning Dart Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Web components with Polymer.dart


The Polymer.dart framework provides a set of Polymer (UI and other) components, but it will only work in the most recent versions of browsers: IE9, IE10, Safari 6, Firefox, and the latest Chrome version (also for Android). It is important to know that, in Polymer, you can only have a single Dart script tag on an HTML document. So, get started with creating a new Polymer application, polymer1, by selecting the Polymer Web application project template (using the polymer library) in Dart Editor.

A new Polymer application

Inspecting pubspec.yaml will reveal the polymer dependency as well as a transformer:

dependencies:
  browser: '>=0.10.0 <0.11.0'
  paper_elements: '>=0.7.0 <0.8.0'
  polymer: '>=0.16.0 <0.17.0'
transformers:
- polymer:
    entry_points: web/index.html

Pub is invoked automatically and it installs polymer and a whole group of packages needed by polymer (such as observe, polymer_expressions, web_components, and so on). We'll now...