subscribeOf<T> method

BroadcastSubscription<T> subscribeOf<T>(
  1. ValueChanged<T?> onData, {
  2. bool current = true,
  3. bool nullOk = true,
})

Subscribe to global object stream for given Type. This Type is used as broadcast key. onData callback is triggered when broadcast with specified key and correct value is called. current when object for given key is stored from previous broadcast, then onData is notified immediately.

Returns BroadcastSubscription to control and close subscription.

Implementation

BroadcastSubscription<T> subscribeOf<T>(
  ValueChanged<T?> onData, {
  bool current = true,
  bool nullOk = true,
}) {
  assert(T != dynamic);

  return subscribeTo<T>(T, onData, current: current, nullOk: nullOk);
}