removeTopic<T> method

  1. @override
bool removeTopic<T>({
  1. List<String>? paths,
  2. String? separator,
})
override

Removes the topic on this side and asks the worker to remove it too.

The call is synchronous for the main-side bus; the worker applies the delete in message order before the next event sent to it. A handler registered in the worker for this topic stays; use EventBusHandlers.removeHandler on the worker bus for a full forget.

Implementation

@override
bool removeTopic<T>({List<String>? paths, String? separator}) {
  if (isDisposed) {
    throw StateError('EventBusIsolate is disposed');
  }
  if (!_ready) {
    throw StateError(
        'EventBusIsolate is not initialized: await waitInit before removeTopic');
  }
  final topic = Topic.create<T>(
      paths: paths, separator: separator ?? defaultTopicPathSeparator);
  if (TopicPattern.isPattern(topic)) {
    TopicPattern.validate(topic);
  }
  final removed = _removeTopicLocally(topic);
  _link.removeTopic(topic);
  return removed;
}