Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.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
Spring boot 带字符串的Dart HTTP POST,整数正文到spring引导_Spring Boot_Flutter_Dart_Http Post - Fatal编程技术网

Spring boot 带字符串的Dart HTTP POST,整数正文到spring引导

Spring boot 带字符串的Dart HTTP POST,整数正文到spring引导,spring-boot,flutter,dart,http-post,Spring Boot,Flutter,Dart,Http Post,我的控制器 @后期映射(“/user/create”) 公共HashMapcreatebody(@Valid@RequestBody用户){ } 颤振代码 Future registerUser()异步{ Map body=Map(); 正文['nick_name']=“anu”; 正文['user\u profile\u id']=“123”; 最终响应=等待http.post(姿势,标题:{ “内容类型”:“应用程序/json”, }, body:json.encode(body)); //

我的控制器

@后期映射(“/user/create”)

公共HashMapcreatebody(@Valid@RequestBody用户){

}

颤振代码

Future registerUser()异步{

Map body=Map();
正文['nick_name']=“anu”;
正文['user\u profile\u id']=“123”;
最终响应=等待http.post(姿势,标题:{
“内容类型”:“应用程序/json”,
},
body:json.encode(body));
//印刷品(正文);
如果(response.statusCode==200){
打印(“成功”);
返回0;
}否则{
抛出异常(“注册失败”);
}
}
Map body=Map();
正文['nick_name']=“anu”;
正文['user\u profile\u id']=“123”;
var response=wait http.post(postrl,body:body);
LOGGER.info("controller hit");
  try {
      userRepository.save(users);  
      } 
      catch (Exception e) {
    return ReturnsMap(1, e.getMessage(), null);
  }
   
    return ReturnsMap(0, "User created", users);        
Map<String, string> body = Map();

body['nick_name'] = "anu";

body['user_profile_id'] = "123";

 final response = await http.post(postURL,  headers: <String, String>{
     
      'Content-Type': 'application/json',
    },
    
   body: json.encode(body));
     //print(body);

   if (response.statusCode == 200) {
  print("success");
    return 0;

} else {
  throw Exception('Failed to registration');      
}
Map<String, string> body = Map();
body['nick_name'] = "anu";
body['user_profile_id'] = "123";
var response = await http.post(postURL,  body: body);