cancel method Null safety

void cancel ()

Cancels the connection attempt.

This also causes the socket Future to complete with a SocketException error.

Implementation

void cancel() {
  _onCancel();
}