登录Flutter应用程序时出现以下错误。
HandshakeException:客户端中的握手错误(操作系统错误: CERTIFICATE_VERIFY_FAILED:好的(handshake.cc:354))
该如何删除该错误?
String token;
class LoginService {
final String _url =
"....";
http.Client _client;
LoginService() {
_client = IOClient();
}
LoginService.customClient(this._client);
Future<LoginResponse> login(String username, String password) async {
final response = await _client.post(
_url + "/login",
headers: {'Content-Type': 'application/json'},
body:
'{"username": "$username","password": "$password","uuid": "$_uuid"}',
);
if (response.statusCode == 200 || response.statusCode == 201) {
Map<String, dynamic> responseJson = json.decode(response.body);
token = LoginResponse.fromJson(responseJson).getToken;
return LoginResponse.fromJson(responseJson);
} else {
throw Exception("Error logging in");
}
}
}