I have this problem when i try to GetData From Mysql in flutter Handshake error in client (OS ErrorWRONG_VERSION_NUMBER(tls_record.cc:242)

Viewed 72

image for the problem

part of code

Future getData() async {
    var url = Uri.parse("https://10.0.2.2:8000/drop/");
    var res = await http.get(url);
    var resb = jsonDecode(res.body);
    return (resb);
2 Answers

maybe its a http , https problem did you try it like this without parsing the url ?

Future getData() async {
    var res = await http.get("https://10.0.2.2:8000/drop/");
    var resb = jsonDecode(res.body);
    return (resb); 

or like this :

Future getData() async {
    var url = Uri.tryParse("https://10.0.2.2:8000/drop/");
    var res = await http.get(url);
    var resb = jsonDecode(res.body);
    return (resb);

also this happens when an HTTPS client reaches an HTTP endpoint

it should be with htos

var url = Uri.https('10.0.2.2:8000', 'drop/')

see manual

Related