description

# startConnect static method

Future<ConnectionTask<RawSecureSocket>> startConnect(

1. dynamic host,
2. int port, {
3. SecurityContext? context,
4. bool onBadCertificate(
   1. X509Certificate certificate
   )?,
5. void keyLog(
   1. String
   )?,
6. List<String>? supportedProtocols,

})
override

Like connect, but returns a Future that completes with a ConnectionTask that can be cancelled if the RawSecureSocket is no longer needed.

## Implementation

    static Future<ConnectionTask<RawSecureSocket>> startConnect(
      host,
      int port, {
      SecurityContext? context,
      bool onBadCertificate(X509Certificate certificate)?,
      void keyLog(String line)?,
      List<String>? supportedProtocols,
    }) {
      return RawSocket.startConnect(host, port).then((
        ConnectionTask<RawSocket> rawState,
      ) {
        Future<RawSecureSocket> socket = rawState.socket.then((rawSocket) {
          return secure(
            rawSocket,
            context: context,
            onBadCertificate: onBadCertificate,
            keyLog: keyLog,
            supportedProtocols: supportedProtocols,
          );
        });
        return ConnectionTask<RawSecureSocket>._(socket, rawState._onCancel);
      });
    }