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:
class MyPlaybackElement extends PolymerElement {
@observable int x;
// Reading xTimes2 will return x * 2.
@ComputedProperty('x * 2')
int get xTimes2 => readValue(#xTimes2);
If the polymer expression is assignable, you can also define a setter for it. For example:
// Reading c will return a.b, writing c will update a.b.
@ComputedProperty('a.b')
get c => readValue(#c);
set c(newValue) => writeValue(#c, newValue);
The expression can do anything that is allowed in a polymer expresssion, even making calls to methods in your element. However, dependencies that are only used within those methods and that are not visible in the polymer expression, will not be observed. For example:
// Because `x` only appears inside method `m`, we will not notice
// that `d` has changed if `x` is modified. However, `d` will be
// updated whenever `c` changes.
@ComputedProperty('m(c)')
get d => readValue(#d);
m(c) => c + x;
A polymer expression, evaluated in the context of the custom element where this annotation is used.
Get a hash code for this object.…
A representation of the runtime type of the object.
The equality operator.…
Invoked when a non-existent method or property is accessed.…
Returns a string representation of this object.