Flutter-状态代码错误时如何启动URL

时间:2018-11-05 22:22:11

标签: http flutter flutter-dependencies

使用url_launcher,我可以启动一个URL,例如https://httpstat.us/200,它模拟状态代码200:确定,而url_launcher可以很好地启动此URL。

我正在寻找一种方法来强制url_launcher启动另一个通常断开的链接,例如https://httpstat.us/204,该链接返回状态码204:无内容。

在我的代码中,我在按下按钮时启动了运行特定的launch_url算法,但是当我执行此操作时,没有任何反应。

这是我的控制台错误:

[VERBOSE-2:shell.cc(188)] Dart Error: Unhandled exception:
HandshakeException: Handshake error in client (OS Error:
CERTIFICATE_VERIFY_FAILED: ok(handshake.cc:363))
#0      IOClient.send (package:http/src/io_client.dart:33:23)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:169:38)
<asynchronous suspension>
#2      BaseClient.get (package:http/src/base_client.dart:32:7)
#3      get.<anonymous closure> (package:http/http.dart:46:36)
#4      _withClient (package:http/http.dart:166:20)
<asynchronous suspension>
#5      get (package:http/http.dart:46:5)
#6      HomePageState._launchString (package:web_check/main.dart:41:36)
<asynchronous suspension>
#7      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
#8      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30)
#9      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
#10     TapGestureRecog<…>

谢谢杰克

0 个答案:

没有答案