removeHandler method

void removeHandler(
  1. String type,
  2. ProtocolMessageHandler handler
)

Implementation

void removeHandler(String type, ProtocolMessageHandler handler) {
  final registeredHandler = _handlers[type];
  if (!identical(registeredHandler, handler)) {
    throw StateError('handler mismatch for $type');
  }
  _handlers.remove(type);
  final current = _room._protocolInstance.getHandler(type);
  if (identical(current, registeredHandler)) {
    _room._protocolInstance.removeHandler(type, current!);
  }
}