this is what i tried:
Future<User> guestLogin(String deviceID) async {
var body = {
"deviceid": deviceID,
};
var bodyEncoded = json.encode(body);
Response response = await client.post(
"$_baseURL/api/user/guest",
body: bodyEncoded,
headers: {"Content-Type": "application/json"},
);
return User.fromJson(json.decode(response.body));
}
but when i check it from serverside which coded by golang then i see that the body is empty. when i try it on postman its working well. Where is the problem?
try jsonEncode(body)
instead of json.encode(body)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.