library polymer


Custom HTML tags, data binding, and templates for building structured, encapsulated, client-side web apps.

Polymer.dart, the next evolution of Web UI, is an in-progress Dart port of the Polymer project. Polymer.dart compiles to JavaScript and runs across the modern web.

To use polymer.dart in your application, first add a dependency to the app's pubspec.yaml file. Instead of using the open-ended any version specifier, we recommend using a range of version numbers, as in this example:

dependencies:
  polymer: '>=0.7.1 <0.8'

Then import the library into your application:

import 'package:polymer/polymer.dart';

Other resources

Constants

initMethod → dynamic

We only ever need one instance of the _InitMethod class, this is it.

const const _InitMethod()
observable ObservableProperty

Use @observable to make a field automatically observable, or to indicate that a property is observable. This only works on classes that extend or mix in Observable.

const const ObservableProperty()
published → dynamic

Use this annotation to publish a property as an attribute.

const const PublishedProperty()
reflectable Reflectable

This can be used to retain any properties that you wish to access with Dart's mirror system. If you import package:observe/mirrors_used.dart, all classes or members annotated with @reflectable wil be preserved by dart2js during compilation. This is necessary to make the member visible to PathObserver, or similar systems, once the code is deployed, if you are not doing a different kind of code-generation for your app. If you are using polymer, you most likely don't need to use this annotation anymore.

const const Reflectable()
whenPolymerReady → dynamic

const const _WhenPolymerReady()

Properties

observerSentinelForTesting → dynamic

read-only
windowLocation ObservableLocationHash

An observable version of window.location.hash.

read-only

Functions

bindCssClass(Element element, String className, Observable object, String path) PathObserver

Deprecated use class="{{ binding }}" in your HTML instead. It will also work on a <polymer-element>.

configureForDeployment() → void

Configures initPolymer making it optimized for deployment to the internet. Additionally, after this method is called initPolymer omits the Zone that automatically invokes Observable.dirtyCheck.

initPolymer() → Future<Zone>

Initializes a polymer application as follows: * if running in development mode, set up a dirty-checking zone that polls

onPropertyChange(Observable source, Symbol sourceName, void callback()) → StreamSubscription

Forwards an observable property from one object to another. For example:

startPolymer() → Future

Starts polymer by hooking the polymer.js code. Note: this function is not meant to be invoked directly by application developers. It is invoked by initPolymer.

toObservable(value, {bool deep: true}) → dynamic

Converts the Iterable or Map to an ObservableList or ObservableMap, respectively. This is a convenience function to make it easier to convert literals into the corresponding observable collection type.

updateCssClass(Element element, String className, bool value) → void

Deprecated use CssClassSet.toggle instead.

Classes

AutoBindingElement

The auto-binding-dart element extends the template element. It provides a quick and easy way to do data binding without the need to setup a binding delegate or use the templateBind call. Both data and event handlers can be bound using the model.

Bindable

An object that can be data bound.

ChangeNotifier

Mixin and base class for implementing an Observable object that performs its own change notifications, and does not need to be considered by Observable.dirtyCheck.

ChangeRecord

Records a change to an Observable.

CompoundObserver

CompoundObserver is a Bindable object which knows how to listen to multiple values (registered via addPath or addObserver) and invoke a callback when one or more of the values have changed.

ComputedProperty

Use this to create computed properties that are updated automatically. The annotation includes a polymer expression that describes how this property value can be expressed in terms of the values of other properties. For example:

CustomTag

Automatically registers a polymer element.

HtmlImport

Annotation for a dart library which injects an html import into the current html document. The imported file must not contain any dart script tags, as they cannot be dynamically loaded.

Indexable

An object accepted by PropertyPath where properties are read and written as indexing operations, just like a Map.

ListChangeRecord

A summary of an individual change to a List.

ListPathObserver

Observes a path starting from each item in the list.

MapChangeRecord

Observable

Represents an object with observable properties. This is used by data in model-view architectures to notify interested parties of changes to the object's properties (fields or getter/setter pairs).

ObservableBox

An observable box that holds a value. Use this if you want to store a single value. For other cases, it is better to use ObservableList, ObservableMap, or a custom Observable implementation based on Observable. The property name for changes is "value".

ObservableList

Represents an observable list of model values. If any items are added, removed, or replaced, then observers that are listening to changes will be notified.

ObservableLocationHash

ObservableMap

Represents an observable map of model values. If any items are added, removed, or replaced, then observers that are listening to changes will be notified.

ObservableProperty

An annotation that is used to make a property observable. Normally this is used via the observable constant, for example:

ObserveProperty

Use this type to observe a property and have the method be called when it changes. For example:

ObserverTransform

ObserverTransform is used to dynamically transform observed value(s).

PathObserver

A data-bound path starting from a view-model or model object, for example foo.bar.baz.

Polymer

The mixin class for Polymer elements. It provides convenience features on top of the custom elements web standard.

PolymerDeclaration

Warning this class is experimental and subject to change.

PolymerElement

Base class for PolymerElements deriving from HtmlElement.

PolymerEventBindings

A mixin for a BindingDelegate to add Polymer event support. This is included in PolymerExpressions.

PolymerExpressions

An extension of polymer_expressions.PolymerExpressions that adds support for binding events using on-eventName using PolymerEventBindings.

PolymerJob

Like Timer but can be restarted, and if no duration is supplied uses window.requestAnimationFrame instead of a 0-duration timer.

PropertyChangeRecord

A change record to a field of an observable object.

PropertyPath

A dot-delimieted property path such as "foo.bar" or "foo.10.bar".

PublishedProperty

An annotation used to publish a field as an attribute. See published.

Reflectable

An annotation that is used to make a type or member reflectable. This makes it available to PathObserver at runtime. For example: