unsubscribe method

void unsubscribe(
  1. VoidCallback listener
)

Removes a previously registered listener.

Throws an AssertionError if the Pingora has already been disposed or if the listener was never subscribed.

Implementation

void unsubscribe(VoidCallback listener) {
  assert(
    !_disposed,
    AssertionError('Can not unsubscribe from a disposed Pingora'),
  );
  final removed = _listeners.remove(listener);
  assert(removed, 'Tried to remove a listener that was not subscribed');
  developer.log(
    'Pingora<$runtimeType> unsubscribed (listeners: ${_listeners.length})',
    name: 'pingora',
  );
}