Home > Mobile >  I get an error while I send the following http get request. I use flutter 2.5
I get an error while I send the following http get request. I use flutter 2.5

Time:11-08

Here is the line of code the causes the error

var currencyData = await http.get(Uri.parse('https://rest.coinapi.io/v1/exchangerate/BTC/USD?apikey=------------------------'));

Here is the error log

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): 

CodePudding user response:

This is a https protocol issue. Since the url is working fine, is more like that there is a problem with your device. Trying adjust its clock may fix this problem because https needs both, client and sever, to have the same current time. If this problem persists, try to run your code in a different device.

  • Related