StreamChannelController<T> constructor Null safety

  1. {bool allowForeignErrors = true,
  2. bool sync = false}

Creates a StreamChannelController.

If sync is true, events added to either channel's sink are synchronously dispatched to the other channel's stream. This should only be done if the source of those events is already asynchronous.

If allowForeignErrors is false, errors are not allowed to be passed to the foreign channel's sink. If any are, the connection will close and the error will be forwarded to the foreign channel's StreamSink.done future. This guarantees that the local stream will never emit errors.


StreamChannelController({bool allowForeignErrors = true, bool sync = false}) {
  var localToForeignController = StreamController<T>(sync: sync);
  var foreignToLocalController = StreamController<T>(sync: sync);
  _local = StreamChannel<T>.withGuarantees(, localToForeignController.sink);
  _foreign = StreamChannel<T>.withGuarantees(, foreignToLocalController.sink,
      allowSinkErrors: allowForeignErrors);