Код: Выделить всё
Future SignupClient() async {
if (name.text!= "" || phone.text!= "") {
try {
var res = await http.post(
Uri.parse(ApisConnect.signupApi),
body:
{
"name": name.text,
"phone": phone.text,
}
);
var response = jsonDecode(res.body);
if (response["success"] == true) {
Fluttertoast.showToast(msg: 'signed up successfully');
} else if (response["success"] == false) {
Fluttertoast.showToast(msg: 'try again');
}
} catch (e) {
Fluttertoast.showToast(msg: 'Error $e');
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... th-php-api
Мобильная версия