[SOLVED] Flutter Webview throws Compiling Error.

Problem

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.

Solution

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

That’s All.

Thanks for Reading.

Keep Coding.

Tagged : / / / /

[SOLVED] Flutter : Cannot run with sound null safety, because the following dependencies don’t support null safety

Problem

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:

- package:flutter_recaptcha_v2
- package:webview_flutter
- package:http
- package:http_parser

For solutions, see https://dart.dev/go/unsound-null-safety
FAILURE: Build failed with an exception.

* Where:
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

* Try:
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
Exited (sigterm)

Solution

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..

// @dart=2.9

then run your project.

Thanks for reading.

Keep Coding.

Tagged : / / / / / / /

[SOLVED] Flutter : NoSuchMethodError: The getter ‘isEmpty’ was called on null.

Problem

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:

Solution

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.

Now My Code is working Fine.

Thanks for reading.

Keep Coding.

Tagged : / / / / / /

[Solved] Flutter : [core/not-initialized] Firebase has not been correctly initialized. Have you added the “google-services.json” file to the project?

Problem

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? 
E/flutter (15568): 

Solution

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:

 buildscript {
      dependencies {
        // ... other dependencies
        classpath 'com.google.gms:google-services:4.3.3'
      }
    }

2. Lastly, execute the plugin by adding the following underneath the line apply plugin:
add after ‘com.android.application’, within the /android/app/build.gradle file:

apply plugin: 'com.google.gms.google-services'

That’s All.

Thanks for Reading.

Keep Coding.

Tagged : / / / / / / /

Laravel Error:Integrity constraint violation

yesterday : when i am trying to submit data to store in database i got error integrity constraint violation rule

because role_id is foreign key and i did not mention this field in user model.

Solution: after role_id mention in user model my error got solved

https://gist.github.com/rakesh1166-cm/6e233a6d0f51504801713420cb483338#file-users-php

Tagged :