send<T> method

  1. @override
Future send<T>(
  1. T data, {
  2. String? path,
  3. String? fragment,
  4. String? target,
  5. Map<String, String>? arguments,
})
override

Sends an event to the bus. If a handler exists for the topic, it will be called. Returns a Future that completes with the result if EventDTO.completer was called by the handler. If no handler exists, returns null.

Implementation

@override
Future<dynamic> send<T>(T data, {String? path, String? fragment, String? target, Map<String, String>? arguments}) async {
  if (isDisposed) {
    throw StateError('EventBusIsolate is disposed');
  }
  if (!_ready) {
    throw StateError('EventBusIsolate is not initialized: await waitInit before send');
  }
  var dto =
      EventDTO<T>(data, path: path, fragment: fragment, arguments: arguments, target: target, completer: null);
  return _link.request(dto);
}