publish2<T, S> method

void publish2<T, S>(
  1. String topic,
  2. T arg1,
  3. S arg2
)

Publishes the specified event topic along with the given arguments arg1 and arg2 to all registered callbacks for that event.

Implementation

void publish2<T, S>(String topic, T arg1, S arg2) {
  void _send(Function? fn) => fn!.call(arg1, arg2);
  _cache[topic]?.forEach(_send);
  _cacheOnce[topic]?.forEach(_send);
  _cacheOnce.remove(topic);
}