I’m showing an AlertDialog on my App, but when I click on no/cancel then AlertDialog doesn’t dismiss, it keep popping the route where I came from. I’ve used Navigator.of(context).pop(); and Navigator.pop(context, false); but both are not working.
To Dismiss an AlertDialog Navigator.of(context).pop(); works but in my case below code worked.
I have implemented firebase phone Auth in my flutter app but whenever i fill phone no. and click on send otp then it opens a RECAPTCHA verification url in browser by default. I don’t want to show it.
See the below screenshot of popup.
Follow the below Steps :-
Step 1 :- Go to Google Cloud Console, enable the Android Device Check API for your project ( Select the same project which you have created in firebase for flutter App. ). The default Firebase API Key will be used, and needs to be allowed to access the DeviceCheck API.
Step 2 :- If you haven’t added SHA-256 fingerprint in firebase then add it too.
For more information, you can also check Google SafetyNet API for checking Google Play Services installation in device at the time of Phone Authentication.
The android studio while running throws this error and stop the build
A:\flutter.pub-cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:31: error: cannot find symbol private ThreadedInputConnectionProxyAdapterView proxyAdapterView; ^ symbol: class ThreadedInputConnectionProxyAdapterView location: class InputAwareWebView
A:\flutter.pub-cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:112: error: cannot find symbol new ThreadedInputConnectionProxyAdapterView( ^ symbol: class ThreadedInputConnectionProxyAdapterView location: class InputAwareWebView Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors
FAILURE: Build failed with an exception.
ThreadedInputConnectionProxyAdapterView has wrong extension .jav just change it to .java until the flutter team release the fix.
Its Located to :- C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter
I’m using flutter_recaptcha_v2: ^0.1.0. Now, I am trying to run it using flutter run, however, it will not start because of the following error:
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
For solutions, see https://dart.dev/go/unsound-null-safety
FAILURE: Build failed with an exception.
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 21s
Exception: Gradle task assembleDebug failed with exit code 1
If you want run your project with --no-sound-null-safety so now you add this line your main.dart file in top(first line) with comment..
I’m Calling An API and getting response in Variable Data ($data). When data is coming then there is no Error but when I’m getting null as response then getting this error Unhandled Exception: NoSuchMethodError: The getter ‘isEmpty’ was called on null.
When I am using the below code then it is throwing me an error:
That is because $data returns null, So I’ve Used
if(data?.isEmpty ?? true)
? prevents an error if the previous part of the expression results in null and ?? true results in true if the previous part of the expression is null and therefore treats == null and isEmpty the same for the if(...) check.
I’ve connected my flutter app to firebase by adding SHA1 key ( How to Get SHA-1 key in Android Studio for Firebase. ) and package name in firebase console, and also downloaded and provided google-service.json in my flutter app at android/app. But when i run app its Showing an error that i’ve not provided google-service.json file in my app. The Error Says –
E/flutter (15568): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized. Have you added the "google-services.json" file to the project?
After hours of struggle, I am able to figure out the solution.
1. First, add the ‘google-services.json‘ plugin as a dependency inside of the android/build.gradle file: