NativeWebTransport constructor

NativeWebTransport(
  1. String url, [
  2. WebTransportOptions? options,
  3. bool insecureSkipCertificateValidation = false
])

Starts connecting to url.

The constructor never throws; failures surface through ready, exactly like the browser WebTransport constructor.

insecureSkipCertificateValidation is a native-only escape hatch for local development; the portable way to trust a self-signed server is WebTransportOptions.serverCertificateHashes.

Implementation

NativeWebTransport(
  this.url, [
  WebTransportOptions? options,
  this.insecureSkipCertificateValidation = false,
]) : options = options ?? const WebTransportOptions() {
  _ready = _open();
  unawaited(
    _ready.then<void>(
      (_) {},
      onError: (Object error) {
        if (!_closed.isCompleted) _closed.completeError(error);
      },
    ),
  );
}