close method Null safety

  1. @override
Future close()
override

Closes the sink.

The add method must not be called after this method.

Calling this method more than once is allowed, but does nothing.

Implementation

@override
Future close() async {
  if (!_outboundController.hasListener) {
    _outboundController.stream.listen(null);
  }

  if (!_inboundController.hasListener) {
    _inboundController.stream.listen(null);
  }

  await _outboundController.close();
  await _inboundController.close();
}