method bind


Bindable bind(String name, bindable, {bool oneTime: false})

Called by TemplateBinding/NodeBind to setup a binding to the given property. It's overridden here to support property bindings in addition to attribute bindings that are supported by default.

Source

Bindable bind(String name, bindable, {bool oneTime: false}) {
  var decl = propertyForAttribute(name);
  if (decl == null) {
    // Cannot call super.bind because template_binding is its own package
    return nodeBindFallback(this).bind(name, bindable, oneTime: oneTime);
  } else {
    // use n-way Polymer binding
    var observer = bindProperty(decl.name, bindable, oneTime: oneTime);
    // NOTE: reflecting binding information is typically required only for
    // tooling. It has a performance cost so it's opt-in in Node.bind.
    if (enableBindingsReflection && observer != null) {
      // Dart note: this is not needed because of how _PolymerBinding works.
      //observer.path = bindable.path_;
      _recordBinding(name, observer);
    }
    var reflect = _element._reflect;

    // Get back to the (possibly camel-case) name for the property.
    var propName = smoke.symbolToName(decl.name);
    if (reflect != null && reflect.contains(propName)) {
      reflectPropertyToAttribute(propName);
    }
    return observer;
  }
}