subscribe<T> static method

BroadcastSubscription<T> subscribe<T>(
  1. dynamic key,
  2. ValueChanged<T?> onData
)

Subscribe to global object stream for given key and Type. 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

static BroadcastSubscription<T> subscribe<T>(
        dynamic key, ValueChanged<T?> onData) =>
    Control.broadcast.subscribeTo<T>(key, onData);