subscribe method

Object subscribe(
  1. List<Object> key,
  2. SubscriptionCallback callback
)

Obtain the value at location key, and subscribe callback to that key so that future updates will invoke the callback with the new value.

The value is always non-null; if the value is missing, the missing object is used instead.

The empty key refers to the root of the DynamicContent object (i.e. the map manipulated by updateAll and update).

Use unsubscribe when the subscription is no longer needed.

Do not modify the value returned by this method or passed to the given callback (e.g. if it is a map or list). Changes made in this manner will leave the DynamicContent in an inconsistent state.

Implementation

Object subscribe(List<Object> key, SubscriptionCallback callback) {
  return _root.subscribe(key, 0, callback);
}