listen method Null safety
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<dynamic> listen(
void Function(dynamic event)? onData, {
Function? onError,
void Function()? onDone,
bool? cancelOnError = false,
}) =>
_inboundController.stream.listen(
onData,
onError: onError ??
((err, StackTrace st) =>
_logger.severe("ApplicationMessageHub error", err, st)),
onDone: onDone,
cancelOnError: cancelOnError,
);