I get an error while I send the following http get request. I use flutter 2.5 - flutter

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

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

Failed to load dynamic library 'libiris_event_handler.so': dlopen failed: library "libiris_event_handler.so" not found in Agora.io's newest SDK(6.0.0)

So, I just updated my Flutter App to run in the SDK 6.0.0, but for some reason, whenever I start the app in the emulator, I get this error message:
E/flutter (15665): [ERROR:flutter/runtime/dart_isolate.cc(1111)] Unhandled exception:
E/flutter (15665): Invalid argument(s): Failed to load dynamic library 'libiris_event_handler.so': dlopen failed: library "libiris_event_handler.so" not found
E/flutter (15665): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
E/flutter (15665): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
E/flutter (15665): #2 IrisEvent._loadAgoraRtcWrapperLib
package:iris_event/iris_event.dart:23
E/flutter (15665): #3 new IrisEvent
package:iris_event/iris_event.dart:15
E/flutter (15665): #4 _ApiCallExecutorInternal.initilize
package:agora_rtc_engine/…/impl/api_caller.dart:429
E/flutter (15665): #5 _ApiCallExecutor._execute
package:agora_rtc_engine/…/impl/api_caller.dart:183
E/flutter (15665): #6 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17)
E/flutter (15665): #7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
And yeah, I have no idea of what's going on. I even installed this library, the iris_event, but still, same error

Flutter firebase does not initialize

am getting this error.
Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)
I have updated all firebase packages in .yaml, i still have this error
E/flutter (11230): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)
E/flutter (11230): #0 FirebaseCoreHostApi.optionsFromResource (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:242:7)
E/flutter (11230): <asynchronous suspension>
E/flutter (11230): #1 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:89:25)
E/flutter (11230): <asynchronous suspension>
E/flutter (11230): #2 Firebase.initializeApp (package:firebase_core/src/firebase.dart:40:31)
E/flutter (11230): <asynchronous suspension>
E/flutter (11230): #3 main (package:mossbets/main.dart:22:3)
E/flutter (11230): <asynchronous suspension>
E/flutter (11230):
Let me also add i have made the call to initialize firebase. Once i remove the initialisation the app works fine but without firebase
This is probably caused by the new changes with Firebase CLI with firebase options. So to solve this do add :
in your terminal
$ flutterfire configure
then in your main
// Import the generated file
import 'firebase_options.dart';
...
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
...
You probably going to be asked to authenticate your firebase account so you' ll run this in your terminal
dart pub global activate flutterfire_cli
this article will help you...start from step 4 Article
add these two lines to your main.dart main function
void main() async{
WidgetsFlutterBinding.ensureInitialized();
// initializing the firebase app
await Firebase.initializeApp();
runApp(MyApp());
}

Periodic Error in Flutter: Unhandled Exception: Null check operator used on a null value

As soon as I start my App (it happens both in debug and profile mode), the following error occurs:
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value
E/flutter (12391): #0 State.setState (package:flutter/src/widgets/framework.dart:1108)
E/flutter (12391): #1 _PollCardViewState.updatePoll.<anonymous closure> (package:mobile_app/components/poll_card_view/poll_card_view.dart:58)
E/flutter (12391): #2 _rootRunUnary (dart:async/zone.dart:1362)
E/flutter (12391): #3 _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter (12391): #4 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170)
E/flutter (12391): #5 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1207)
E/flutter (12391): #6 _rootRunUnary (dart:async/zone.dart:1370)
E/flutter (12391): #7 _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter (12391): #8 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1191)
E/flutter (12391): #9 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395)
E/flutter (12391): #10 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426)
E/flutter (12391): #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184)
E/flutter (12391):
The error happens periodically in the background and does not affect the app. In fact, the app seems to work just as always.
The error does not mention any of my widgets or different pages. I do not have any clue where this Null check operator is used on a null value.
Yesterday my app was just fine and this error did not happen.
I am not using Flutter Null Safety. But i did not use it from the beginning, and this error never happened before. Does anyone have an idea where the problem is?

Flutter - Error when trying to Sign In with Google and FIrebase

So I'm getting this error when trying to sign in with Google with Firebase.
E/flutter ( 2822): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
E/flutter ( 2822): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
E/flutter ( 2822): #1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822): #2 MethodChannel.invokeMapMethod
package:flutter/…/services/platform_channel.dart:358
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822): #3 GoogleSignIn._callMethod
package:google_sign_in/google_sign_in.dart:235
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822): #4 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart)
package:google_sign_in/google_sign_in.dart:1
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822):
I have followed all the steps (I believe) in integrating the app with Firebase, so does anyone know if this is a common error, and how would I go around fixing it?
If someone needs the code, I can provide it, but it is pretty much boilerplate Google Sign In code.
When I click the sign in button, it lets me choose Google account, but then it goes into infinite loading and throws this error in console.
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) apiException:10 means it's most likely due to incorrect setup of SHA-1 or SHA-256. Since you said that it works at the office, but when you change the device it was not work so make Update SHA-1 or SHA-256 in firebase same as your current device SHA key.

flutter firebase cloud function emulator, on call functions not working

I use firebase emulator and my cloud functions are in error...
I call my function like that :
HttpsCallable displayNameAndEmail = FirebaseFunctions.instanceFor(region: 'europe-west1').httpsCallable("displayNameAndEmail");
displayNameAndEmail.call({
'displayName': "$firstName $lastName",
'lang': lang,
'email': email
});
print("\nDisplayName6\n\n");
And here is the error I get :
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: [firebase_functions/unavailable] UNAVAILABLE
E/flutter (14049):
E/flutter (14049): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
E/flutter (14049): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/flutter (14049): <asynchronous suspension>
E/flutter (14049): #2 MethodChannelHttpsCallable.call (package:cloud_functions_platform_interface/src/method_channel/method_channel_https_callable.dart:22:24)
E/flutter (14049): <asynchronous suspension>
E/flutter (14049): #3 HttpsCallable.call (package:cloud_functions/src/https_callable.dart:34:37)
E/flutter (14049): <asynchronous suspension>
E/flutter (14049):
E/flutter (14049): #0 MethodChannelHttpsCallable.call (package:cloud_functions_platform_interface/src/method_channel/method_channel_https_callable.dart:38:7)
E/flutter (14049): <asynchronous suspension>
E/flutter (14049): #1 HttpsCallable.call (package:cloud_functions/src/https_callable.dart:34:37)
E/flutter (14049): <asynchronous suspension>
E/flutter (14049):
Any idea ?
The first line creates a separate FirebaseFunctions instance (for the specified region). You have to instruct this new instance to connect to the emulator as Frank pointed out in the first comment.
Here is the FlutterFire documentation providing more details. If you are on Android:
remember to use 10.0.2.2 as the host (necessary when using the Android emulator)
add
<application android:usesCleartextTraffic="true"/>
to android\app\src\debug\AndroidManifest.xml. This allows plain HTTP traffic to/from the Firebase emulators.
Another useful mention is to leverage the dart cascade notation, .., as follows:
String ip = Platform.isAndroid ? '10.0.2.2' : 'localhost';
var instance = FirebaseFunctions.instanceFor(region: 'europe-west1')
..useFunctionsEmulator(origin: 'http://$ip:5001');
HttpsCallable displayNameAndEmail =
instance.httpsCallable("displayNameAndEmail");
Also, if you upgrade to the latest version, the FlutterFire team seems to aim for a more uniform approach/interface. All emulator enabling methods (such as useFunctionsEmulator) now accept host and port as positional arguments (previously it took only one named argument, origin).
In my case,
I have only used it like that. I haven't edited the XML, nor do I need to put localhost 10.0.2.2 for android. Just add your region.
FirebaseFunctions.instanceFor(region: "us-central").useFunctionsEmulator('localhost', 5001);