gpt4 book ai didi

http - 如何在 http 请求正文中发送 bool 值或 int 值?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:21:08 25 4
gpt4 key购买 nike

如何在 dart 中的 http 请求正文中发送 bool 值或整数?文档说我只能发送字符串、列表或 map 。如何让它在 Dart 中用于 bool 值或整数?

最佳答案

试试我在项目中使用的这种方法

  void apiPost(){

var body = jsonEncode(
{
"string":"test",
"bool":true,
"int":1
});

http.post("url here",body: body,headers: {"Content-Type": "application/json"}).then((response) {
Map map = json.decode(response.body);
});
}

关于http - 如何在 http 请求正文中发送 bool 值或 int 值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58431209/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com