create method
Implementation
@override
HttpClient create(Map<String, bool> fingerprints) {
// Don't trust any certificate just because their root cert is trusted.
final securityContext = SecurityContext(withTrustedRoots: false);
if (certificateTrustedConfiguration != null) {
for (final certBytes in certificateTrustedConfiguration!.certificates()) {
securityContext.setClientAuthoritiesBytes(certBytes);
}
}
final client = HttpClient(context: securityContext);
// You can test the intermediate / root cert here.
client.badCertificateCallback = (cert, host, port) => certificateValidator
.validateBadCertificate(cert, host, port, fingerprints);
return client;
}