listen method
StreamSubscription<BroadcastEvent>
listen(
- void onData(
- BroadcastEvent event
- Function? onError,
- void onDone()?,
- bool? cancelOnError = false,
override
Adds a listener for messages from other hubs.
You use this method to add listeners for messages from other hubs.
When another hub adds a message, this hub will receive it on onData
.
onError
, if provided, will be invoked when this isolate tries to add invalid data. Only the isolate
that failed to send the data will receive onError
events.
Implementation
@override
StreamSubscription<BroadcastEvent> listen(
void Function(BroadcastEvent event)? onData,
{Function? onError,
void Function()? onDone,
bool? cancelOnError = false}) =>
_inboundController.stream.listen(onData,
onError: onError ??
(err, StackTrace st) =>
_logger.severe('ApplicationEventHub error', err, st),
onDone: onDone,
cancelOnError: cancelOnError);