close method

Future<void> close()

Closes connection (rather immediately), in result should also disconnect.

Implementation

Future<void> close() {
  return Future.wait([
    output.close(),
    _readStreamSubscription.cancel(),
    (!_readStreamController.isClosed)
        ? _readStreamController.close()
        : Future.value(/* Empty future */)
  ], eagerError: true);
}