off<T extends DataObject> method

void off<T extends DataObject>(
  1. void callback(
    1. T message
    )
)

Removes a callback for when a DataObject of type T is received.

Implementation

void off<T extends DataObject>(void Function(T message) callback) {
  for (final subscription
      in _subscriptions.whereType<StreamSubscription<T>>()) {
    if (subscription.onData == callback) {
      subscription.cancel();
      _subscriptions.remove(subscription);
      break;
    }
  }
}