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.
var obj = new ObservableMap.from({'a': 1, 'b': 2}); var otherObj = new ObservableMap.from({'c': 3});
var observer = new CompoundObserver()
..addPath(obj, 'a');
..addObserver(new PathObserver(obj, 'b'));
..addPath(otherObj, 'c');
..open((values) {
for (int i = 0; i < values.length; i++) {
print('The value at index $i is now ${values[i]}');
}
});
obj'a'
= 10; // print will be triggered async
Get a hash code for this object.…
A representation of the runtime type of the object.
Gets the current value of the bindings.
Note: once the value of a Bindable
is fetched, the callback passed to
open
should not be called again with this new value.
In other words, any pending change notifications must be discarded.…
The equality operator.…
Adds a dependency on the property path
accessed from object
.
path
can be a PropertyPath or a String
. If it is omitted an empty
path will be used.
Stops future notifications and frees the reference to the callback passed
to open
, so its memory can be collected even if this Bindable is alive.
Deliver changes. Typically this will perform dirty-checking, if any is needed.
Invoked when a non-existent method or property is accessed.…
Initiates observation and returns the initial value. The callback will be passed the updated value, and may optionally be declared to take a second argument, which will contain the previous value.…
Returns a string representation of this object.