listen method Null safety

  1. @override
StreamSubscription listen(
  1. void onData(
    1. dynamic event
    )?,
  2. {Function? onError,
  3. void onDone(
      )?,
    1. 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<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,
        );