【发布时间】:2021-02-03 05:26:51
【问题描述】:
我正在尝试将数据从颤振发布到节点 API。我的代码如下。
final String uri = "http://localhost:3000";
Map<String, String> userBody = {
"firstName":"Vishal",
"lastName":"Soni",
"email":"vishal@gmail.com",
"mobile":"1234567890",
"password":"123",
};
Future<dynamic> postData() async {
try {
http.Response res = await http.Client().post("$uri/register", body: jsonEncode(userBody), headers: {
'Content-Type': 'application/json',
});
print(res);
} catch (e) {
print(e);
}
}
【问题讨论】:
-
这里没有足够的信息来解决您的问题 - 我将首先验证您的 API 是否正常工作。
标签: flutter dart flutter-web