onBadCertificate property

bool Function(X509Certificate)? onBadCertificate
getter/setter pair

An optional callback for handling server SSL certificate validation.

This function is invoked if the server presents a certificate that is considered invalid or untrusted by the system.

The function must return true to accept the certificate and continue the connection, or false to reject it and abort the connection attempt.

If this callback is null, any invalid certificate will automatically cause the connection to be aborted.

Implementation

bool Function(X509Certificate)? onBadCertificate;