listen method

ActionSubscription listen (dynamic onData(T event))

Supply a callback that will be called any time this Action is dispatched. A payload of type T will be passed to the callback if supplied at dispatch time, otherwise null will be passed. Returns an ActionSubscription which provides means to cancel the subscription.


ActionSubscription listen(dynamic onData(T event)) {
  return new ActionSubscription(() => _listeners.remove(onData));