我Method.Post在使用httpdart库的flutter应用程序中使用时遇到问题。看来,当我尝试从WebAPI发布数据时,它给了我一个提示StatusCode 415。请参阅下面的代码:
代码登录:
Future<User> login(User user) async {
print(URLRequest.URL_LOGIN);
return await _netUtil.post(Uri.encodeFull(URLRequest.URL_LOGIN), body: {
'username': user.username,
'password': user.password
}, headers: {
"Accept": "application/json",
}).then((dynamic res) {
print(res.toString());
});
}
Run Code Online (Sandbox Code Playgroud)
代码NetworkUtils:
Future<dynamic> post(String url, {Map headers, body, encoding}) async {
return await http
.post(url, body: body, headers: headers, encoding: encoding)
.then((http.Response response) {
final String res = response.body;
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode > 400 || json == null) …Run Code Online (Sandbox Code Playgroud) 我对google_maps_flutter图书馆有疑问。有什么功能可以让我在2个标记之间绘制路线?我试图搜索并深入图书馆似乎没有选择(到目前为止)。有人可以帮我吗,或者给我一些文章或教程(必须是正式的Google Maps Flutter插件)来工作?
谢谢,祝您编程愉快。