I am going to run localhost .net API in a flutter to get data from it but I got a lot of errors. why.net API is locally hosted. I want to run a local web API I don't want to host it on a live server.
here is code
static Future fectchCordinates() async
{
HttpClient client = new HttpClient();
client.badCertificateCallback = ((X509Certificate cert, String host, int port) => true);
var studentUrl =Uri.parse('https://10.0.2.2:44363/address-lookup?address=house%20no%20122%20');
//Uri.parse(studentUrl),
print(studentUrl);
http.Response response=await http.get(studentUrl,headers: {"Accept": "application/json"});
print(response.body);
return response;
}
E/flutter ( 8373): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter ( 8373): CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:393))
E/flutter ( 8373): #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:99:46)
E/flutter ( 8373): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:142:25)
E/flutter ( 8373): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:911:54)
E/flutter ( 8373): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:1040:19)
E/flutter ( 8373):
E/flutter ( 8373):