Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取http时的颤振参数_Http_Flutter_Dart - Fatal编程技术网

获取http时的颤振参数

获取http时的颤振参数,http,flutter,dart,Http,Flutter,Dart,如何在GET函数上设置参数, 我在dart或FLATTER的文档中没有找到任何与此相关的内容 String url = 'xxxxxx'; Future<String> makeRequest() async { Map params = { "anunciante_name" "anunciante_pass" "anunciante_email" }; var _body = jsonDecode(params); var response = await h

如何在GET函数上设置参数, 我在dart或FLATTER的文档中没有找到任何与此相关的内容

String url = 'xxxxxx';

Future<String> makeRequest() async {

Map params = {
  "anunciante_name"
  "anunciante_pass"
  "anunciante_email"
};

var _body = jsonDecode(params);

var response = await http
.get(Uri.encodeFull(url), headers: {"Content-type": "application/json", "key": "xxxxx", "token": "xxxxx"},);

print(response.body);
stringurl='xxxxxx';
Future makeRequest()异步{
映射参数={
“anunciante_名称”
“anunciante_通行证”
“anunciante_电子邮件”
};
var_body=jsonDecode(参数);
var response=wait http
.get(Uri.encodeFull(url),标题:{“内容类型”:“应用程序/json”,“键”:“xxxxx”,“令牌”:“xxxxx”},);
打印(响应.正文);
根据对象

Future-get(动态url,{Map-headers})
第二个参数是
标题
。您可以将您的每个参数作为值传递给它,传递方式与传递
令牌
内容类型

Map-reqHeaders={
“内容类型”:“应用程序/json”,
“密钥”:“xxxxx”,
“令牌”:“xxxxx”,
“anunciante_name”:名称,
“Anuciante_pass”:密码,
“anunciante_电子邮件”:电子邮件
};
var response=wait http.get(Uri.encodeFull(url),{headers:reqHeaders});

you save me…还有一个问题…每次我尝试使用response.statusCode==200时,它都会说statusCode不是我试图创建的变量,但它仍然是一个错误,在互联网示例中,没有人定义变量statusCode,他们只是将其当作dartOkay@Ericmonterales的本机使用,我必须查看您的code。接收附加了
statusCode
属性的响应对象不依赖于您的颤振/前端代码。服务器api附加了
statusCode
。请检查api的api文档,查看响应是否附加了
statusCode
属性。同时检查是否附加了
ok
属性有时,响应中会附加一个值为
true
false
ok
属性,而不是200I的
statusCode
,这与您说的很像,再次感谢您所做的一切