发送以下 http get 请求时出现错误。我用颤振2.5
I get an error while I send the following http get request. I use flutter 2.5
这是导致错误的代码行
var currencyData = await http.get(Uri.parse('https://rest.coinapi.io/v1/exchangerate/BTC/USD?apikey=------------------------'));
这是错误日志
E/flutter (20209): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (20209): CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359))
E/flutter (20209): #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter (20209): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter (20209): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter (20209): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter (20209): <asynchronous suspension>
E/flutter (20209):
D/mali_winsys(20209): new_window_surface returns 0x3000, [720x1280]-format:1
D/libEGL (20209): eglInitialize EGLDisplay = 0xd867f7c4
I/OpenGLRenderer(20209): Initialized EGL, version 1.4
D/mali_winsys(20209): new_window_surface returns 0x3000, [720x1280]-format:1
I/Timeline(20209): Timeline: Activity_idle id: android.os.BinderProxy@a6bd033 time:158054628
E/flutter (20209): [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (20209): CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359)), stack trace: #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter (20209): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter (20209): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter (20209): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter (20209): <asynchronous suspension>
E/flutter (20209):
这是一个 https 协议问题。由于 url 工作正常,更像是您的设备有问题。尝试调整它的时钟可能会解决这个问题,因为 https 需要客户端和服务器都具有相同的当前时间。
如果此问题仍然存在,请尝试 运行 在不同的设备中使用您的代码。
这是导致错误的代码行
var currencyData = await http.get(Uri.parse('https://rest.coinapi.io/v1/exchangerate/BTC/USD?apikey=------------------------'));
这是错误日志
E/flutter (20209): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (20209): CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359))
E/flutter (20209): #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter (20209): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter (20209): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter (20209): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter (20209): <asynchronous suspension>
E/flutter (20209):
D/mali_winsys(20209): new_window_surface returns 0x3000, [720x1280]-format:1
D/libEGL (20209): eglInitialize EGLDisplay = 0xd867f7c4
I/OpenGLRenderer(20209): Initialized EGL, version 1.4
D/mali_winsys(20209): new_window_surface returns 0x3000, [720x1280]-format:1
I/Timeline(20209): Timeline: Activity_idle id: android.os.BinderProxy@a6bd033 time:158054628
E/flutter (20209): [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (20209): CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359)), stack trace: #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter (20209): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter (20209): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter (20209): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter (20209): <asynchronous suspension>
E/flutter (20209):
这是一个 https 协议问题。由于 url 工作正常,更像是您的设备有问题。尝试调整它的时钟可能会解决这个问题,因为 https 需要客户端和服务器都具有相同的当前时间。 如果此问题仍然存在,请尝试 运行 在不同的设备中使用您的代码。