stop method

  1. @override
Future<void> stop({
  1. Exception? exception,
})
override

Implementation

@override
Future<void> stop({Exception? exception}) async {
  if (_connectionState == ConnectionState.disconnected) {
    _logging!(LogLevel.debug,
        'Call to HttpConnection.stop(${exception.toString()}) ignored because the connection is already in the disconnected state.');
    return Future.value(null);
  }

  if (_connectionState == ConnectionState.disconnecting) {
    _logging!(LogLevel.debug,
        'Call to HttpConnection.stop(${exception.toString()}) ignored because the connection is already in the disconnecting state.');
    return Future.value(null);
  }

  _connectionState = ConnectionState.disconnecting;

  _stopCompleter = Completer();

  _stopFuture = _stopCompleter.future;

  await _stopInternal(exception: exception);
  await _stopFuture;
}