Hi i cant not get the value of de value that return my function postTest()
String usuario = usernameController.text;
print('Si $usuario');
String password = passwordController.text;
print('Password: $password');
print("${postTest(usuario, password)}");
}
},
),
Registrate(),
],
),
),
),
),
),
),
Container(
padding: EdgeInsets.only(top: 500, left: 170),
child: ImagenAmbulancia(),
)
],
),
),
),
);
}
postTest(usuario, password) async {
final uri = 'http://10.0.2.2:5000/base/';
http.Response response = await http
.post(Uri.parse(uri), body: {"User": usuario, "Pass": password});
var repuesta = response.body;
String estadoUsuario = jsonDecode(repuesta)["respuesta"];
return estadoUsuario;
}
}
i try to save the value that get me postTest but i cant ... return me Future , but i want the string
when you want to use your method, because its future type (and will be fill in future) you should use
.thenwhen you call your method like this