remove method

  1. @protected
bool remove(
  1. dynamic key
)

Implementation

@protected
bool remove(dynamic key) {
  if (key is KeyController) {
    if (_listener.containsKey(key.key)) {
      final sub = _listener[key.key];
      switch (key.keyType) {
        case KeyType.cancel:
          _listener.remove(key.key);
          sub?.cancel();
          break;
        case KeyType.pause:
          sub?.pause();
          break;
        case KeyType.resume:
          sub?.resume();
          break;
        default:
          Log.w('error $key', onlyDebug: false);
      }
      return true;
    } else if (key.key is SendHandle &&
        identical(key.keyType, KeyType.closeServer)) {
      final sp = key.key;
      onClose().whenComplete(() => sp
          .send(SendHandleName('${key.serverName}', sp, isToRemote: false)));

      return true;
    }
  }
  return false;
}