I am getting the HandshakeException: Connection terminated during handshake on Testflight on my Flutter app and also on Android phone, it shows for some users, for others don't, it is also sometimes not always which makes it more difficult. I have test some of the answers from similar questions here on stack overflow like HttpOverrides.global = MyHttpOverrides(); It didn't work. Here is the code use to connect with the server:
Future<Map> postingHeader(String endPoint, Map<String, dynamic> map) async{
var client = new http.Client();
try {
Map<String, String> headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/x-www-form-urlencoded",
"Access-Control-Allow-Origin": "*"};
final response1 =await http.head(Uri.parse(endPoint));
http.Response response = await client.post(
Uri.parse(endPoint),
headers: headers,
body: map,
);
Map<String, dynamic> rest = json.decode(response.body);
return rest;
} finally{
client.close();
}
}
I have flutter 3.26.0-1.0 version, just mentioning as I saw that that was an issue in some old version on github forum. And also http plugin version: 0.13.5. Off course to test the HttpClient Override I switch to dart:io, but it was the same issue. Does anybody knows what the problem could be? Or if it is the server, but as I say it works sometimes Thank you