【发布时间】:2021-10-05 15:01:27
【问题描述】:
我使用 Dio 进行 http 请求,post 方法的功能是这样的:
Future<Response?> post(String url, dynamic data) async {
try {
Response response = await baseAPI.post(url, data: data);
return response;
} on DioError catch(e) {
throw Failure(e.message);
}
}
然后当我使用这个 post 方法时,我得到的响应是在 'Future
void login(String email, String password) {
dynamic data = jsonEncode(<String, String>{
'email': email,
'password':password,
});
Future<Response?> response = loginService.post('https://reqres.in/api/login',data) ;
print(response);
print('response data print');
}
【问题讨论】:
标签: flutter dio flutter-http