dispose method

void dispose()

Cancel all the registered subscriptions. After calling this method, all the events published won't be delivered to the cleared responders any more.

No harm to call more than once.

Implementation

void dispose() {
  if (subscriptions.isEmpty) {
    return;
  }
  for (final s in subscriptions) {
    s.cancel();
  }
  subscriptions.clear();
}