[SOLVED] Flutter : Waiting for another flutter command to release the startup lock.

Problem

When I run my flutter application it shows below message

Waiting for another flutter command to release the startup lock

and not proceed further.

Solution

Run the following command in Terminal.

For Mac OS

killall -9 dart

For Windows OS

taskkill /F /IM dart.exe

After Executing the Command in Terminal, Close your VS Code and Reopen the Project and let editor to complete all things. Now run your app it will run without any issue.

That’s All.

Thanks for reading.

Keep Coding.

How to Change Passport Token length in laravel.

Solution

To change Laravel Passport Access Token length run the below command in terminal.

php artisan passport:keys --length=512 --force

where you can specify your length what you want.

That’s All.

Thanks for Reading.

Keep Coding.

Flutter : How to dismiss an AlertDialog on Button?

Problem

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.

Solution

To Dismiss an AlertDialog Navigator.of(context).pop(); works but in my case below code worked.

Navigator.of(context, rootNavigator: true).pop('dialog');

That’s All.

Thanks for reading.

Keep Coding.

Tagged : / / /

[SOLVED] Flutter : firebase_core_web not found. Please update settings.gradle.

Solution

In your android/app/build.gradle, update the following:

android {
    // ...
    defaultConfig {
        // ...
        minSdkVersion 16
    }
}

into:

android {
    // ...
    defaultConfig {
        // ...
        minSdkVersion 23
    }
}


Note: You need to use minSdkVersion 23 when using firebase in flutter.

That’s All.

Thanks for reading.

Keep Coding.

Tagged : / / / / /

[SOLVED] Flutter: Not showing “Open for editing in Android Studio”

The problem is caused by missing .iml project files. These files are added automatically to the .gitignore file but they should not. To fix it:

  1. Delete .idea folder.
  2. Create a new temporary Flutter project with the same name.
  3. Copy from the project to your existing project these 2 missing files:
  • [project_name].iml
  • android/[project_name]_android.iml
  1. Open Android Studio and the problem should be gone.

To avoid it in the future, make sure .iml files are not excluded in the gitignore. There is a Github issue on this topic.

Tagged : / / / / / /

[SOLVED] Flutter : A problem was found with the configuration of task ‘:google_maps_flutter:createFullJarDebug’ (type ‘ZipMergingTask’).

Problem

A problem was found with the configuration of task ‘:google_maps_flutter:createFullJarDebug’ (type ‘ZipMergingTask’).

Launching lib\main.dart on Mi MIX 2 in debug mode...
Parameter format not correct -
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core-1.2.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_auth-1.2.0\android\src\main\java\io\flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_local_notifications-5.0.0+1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\launch_review-3.0.1\android\src\main\java\com\iyaffle\launchreview\LaunchReviewPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\google_sign_in-4.5.9\android\src\main\java\io\flutter\plugins\googlesignin\GoogleSignInPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.3\android\src\main\java\io\flutter\plugins\googlemaps\Convert.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\susha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.3\android\src\main\java\io\flutter\plugins\googlemaps\TileProviderController.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':google_maps_flutter:createFullJarDebug' (type 'ZipMergingTask').
> File 'D:\flutter_projects\crud_app\build\google_maps_flutter\intermediates\runtime_library_classes\debug\classes.jar' specified for property 'libraryInputFile' does not exist.
* 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 35s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Solution

Solution for this issue is : delete the .grade file in the android folder of project file.

How To Remove RECAPTCHA From Phone Auth In Flutter Firebase

Problem

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.

enter image description here

Solution

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.

That’s All

Thanks for Reading.

Keep Coding.

[SOLVED] Flutter : Unhandled Exception: type ‘int’ is not a subtype of type ‘String’ in type cast

Problem

I’m Calling An API to update my data and I got this error, the Error Says,

E/flutter (32582): type 'int' is not a subtype of type 'String' in type cast

Solution

Step 1: use "content-type": "application/json" in header

Step 2: encode your body like jsonEncode( {"param1": 10, "param2":20,"param3": "abc","param4": true})

Example Code Like

headers: {
"content-type": "application/json",
},
body:jsonEncode( {
"qualificationId": 10,
"year":2001,
"instituteName": "example",
"isActive": true
})

That’s it.

Thanks for Reading.

Keep Coding.

[SOLVED] FlutterFirebaseMessagingPlugin.java – Build fails with Exception “error: cannot find symbol”

Problem

After upgrading firebase_auth to latest version (i.e., ^1.2.0), it says update intl to ^0.17.0. When i updated intl, I’m getting errors when I try to run flutter pub get.

C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:20: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceId;
^
symbol:   class FirebaseInstanceId
location: package com.google.firebase.iid
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:21: error: cannot find symbol
import com.google.firebase.iid.Metadata;
^
symbol:   class Metadata
location: package com.google.firebase.iid
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:152: error: cannot find symbol
: Metadata.getDefaultSenderId(FirebaseApp.getInstance());
^
symbol:   variable Metadata
location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:153: error: cannot find symbol
FirebaseInstanceId.getInstance().deleteToken(senderId, "*");
^
symbol:   variable FirebaseInstanceId
location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:165: error: cannot find symbol
: Metadata.getDefaultSenderId(FirebaseApp.getInstance());
^
symbol:   variable Metadata
location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:166: error: cannot find symbol
String token = FirebaseInstanceId.getInstance().getToken(senderId, "*");
^
symbol:   variable FirebaseInstanceId
location: class FlutterFirebaseMessagingPlugin

Solution

Update firebase_messaging to latest one (Currently i.e., firebase_messaging: ^10.0.0), and call flutter pub get.

That’s it.

Thanks for Reading.

Keep Coding.

Tagged : / / / /

[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 : / / / /