StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), {Function onError, void onDone(), bool cancelOnError})

Adds a subscription to this stream.

On each data event from this stream, the subscriber's onData handler is called. If onData is null, nothing happens.

On errors from this stream, the onError handler is given a object describing the error.

The onError callback must be of type void onError(error) or void onError(error, StackTrace stackTrace). If onError accepts two arguments it is called with the stack trace (which could be null if the stream itself received an error without stack trace). Otherwise it is called with just the error object. If onError is omitted, any errors on the stream are considered unhandled, and will be passed to the current Zone's error handler. By default unhandled async errors are treated as if they were uncaught top-level errors.

If this stream closes, the onDone handler is called.

If cancelOnError is true, the subscription is ended when the first error is reported. The default is false.

Source

StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s),
                                           {Function onError,
                                            void onDone(),
                                            bool cancelOnError}) {
  return _controller.stream.listen(onData,
                                   onError: onError,
                                   onDone: onDone,
                                   cancelOnError: cancelOnError);
}