method reflectPropertyToAttribute


void reflectPropertyToAttribute(String path)

Source

void reflectPropertyToAttribute(String path) {
  // TODO(sjmiles): consider memoizing this
  // try to intelligently serialize property value
  final propValue = new PropertyPath(path).getValueFrom(this);
  final serializedValue = serializeValue(propValue);
  // boolean properties must reflect as boolean attributes
  if (serializedValue != null) {
    attributes[path] = serializedValue;
    // TODO(sorvell): we should remove attr for all properties
    // that have undefined serialization; however, we will need to
    // refine the attr reflection system to achieve this; pica, for example,
    // relies on having inferredType object properties not removed as
    // attrs.
  } else if (propValue is bool) {
    attributes.remove(path);
  }
}