SocketAdaptor constructor

SocketAdaptor(
  1. SocketInterface impl, {
  2. InternetAddress address,
  3. InternetAddress remoteAddress,
  4. int port,
  5. int remotePort,
  6. StringCallback debugPrint,
})

Implementation

SocketAdaptor(this.impl,
    {this.address,
    this.remoteAddress,
    this.port,
    this.remotePort,
    this.debugPrint}) {
  controller = StreamController<Uint8List>(sync: true);
  consumer = SocketAdaptorStreamConsumer(this);
  sink = IOSink(consumer);

  /// https://github.com/dart-lang/sdk/issues/39589
  impl.listen((Uint8List m) => controller.add(Uint8List.fromList(m)));
  impl.handleError((error) => controller.addError(error));
  impl.handleDone((String reason) => controller.addError(reason));
}