I tried to follow this: https://flutter.dev/docs/cookbook/networking/send-data but code it's not working and i dont know why. Can someone help me and tell me what I have wrong or some video I could use to implement those functions correctly?

What I want to do is to send all the information from a form to the server.

My code: https://github.com/guillemrh/urbix/blob/master/lib/screens/signup_screen_administrador.dart

Thank you

Solution 1: user12541086

The endpoint http://ec2-52-47-176-18.eu-west-3.compute.amazonaws.com/reg/us/ does not support application/json content type. According to this stackoverflow answer http package only has 3 types: String, List or Map. Try this:

var mapData = new Map<String, dynamic>();
mapData['firstname'] = firstname;
mapData['lastname'] = lastname;
mapData['username'] = username;
mapData['email'] = 'email;
mapData['passw'] = passw;
map['user_type'] = 'Administrador';

final http.Response response = await http.post(
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    body: mapData

Also security wise. When dealing with user information such as name, password, and email. Please use HTTPS. You can achieve this on AWS by throwing a load balancer in front of the API server.