I just want to bypass the certificate verification but I het the error that the badCertificateCallback is not defined for client. Do you know how can I make this work?
Thank you.
This is my actual code
http.Client client = http.Client(); HttpClient() { // Load the PEM certificate file during class initialization loadCertificate(); } Future<void> loadCertificate() async { // Load the certificate asset ByteData data = await rootBundle.load('assets/certificate.pem'); // Convert the ByteData to a List<int> List<int> bytes = data.buffer.asUint8List(); // Configure the default HTTP client to use the certificate SecurityContext securityContext = SecurityContext.defaultContext; securityContext.setTrustedCertificatesBytes(bytes); // Set the badCertificateCallback client.badCertificateCallback = (X509Certificate cert, String host, int port) { // Always trust the certificate return true; };`