Flutter app not loading when I add Flutter_auth dependency - flutter

Whenever I try to add the Flutter_auth dependency to my flutter application in the pubspec.yaml file, the app no longer is able to compile. The app however loads fine without the dependency. I have tried creating a fresh Flutter project, running it before adding the dependency, and it runs fine, however after adding the dependency, the app no longer compiles. Odd because I am not changing any lines of code in the actual app.
I am using visual studio code, and attached is a screen recording of the issue at hand. I tried adding the dependency manually, and through the terminal, neither allowed the app to compile. I have also tried running flutter clean in the terminal to clear any cache in the flutter dependencies section.
Please take a look at the screen recording for more details on the flutter version and which other dependencies I am trying to add. Screen Recording
I tried to run the flutter app as a project, running the main.dart file, and I expected the app to compile and launch the debug app, however when I added the firebase_auth dependency, the app no longer launched successfully. When I removed the dependency, the app compiled just fine. Without any changes to the code of the app.

Config app in firebase console, Download googleInfo-plist file to correct location.
Add initializeApp() method in void main():
import 'package:firebase_auth/firebase_auth.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
Check the installation steps on the start firebase documents and authentication to see if you are missing any steps

Related

Assets audio player doesn't work any more

i use flutter and i used assets_audio_player library to run sounds in my app, it was working fine until last day, when i run the code it gives me PlatformException(OPEN,nul,null,null).
I tried to change the version and also tried to restart the app but nothing worked.
I used AudioWidget.assets() to run the sound, it was working fine but when version 3.0.6 was released it didn't work and gives a rethrow error.
enter image description here
enter image description here
enter image description here
I think it can be an Incompatibility or even some error that could happen with build files being not updated or synchronised.
Just to have a clear conscience, please, on your project terminal, run the very old classic:
flutter clean
Then, run
flutter pub get
Stop your running project and rebuild your application
In fact, if it doesn't solve your problem, i would suggest you to downgrade the assets_audio_player to the previous version to when it was working.
Update me if none of this solve your problem.

Flutter could not resolve all files for configuration classpath

I tried to run the basic click counter app in VSCode, but it is not working on emulator, or my physical device either.
These are the errors being thrown.
I have not changed any file from creation of project.

Why app overriding after installing in android?

I build an app using flutter. For example name is ForSaudi. I wanted to copy the same app and which name should be ForJordon.
So ForSaudi is already installed in my mobile. Everything is good. Now I changed the name to ForJordon from AndroidManifest.xml file. After changing name and launcher icon, I installed the app into mobile, which is actually replaced with my previous app. It should not be replaced. Can someone guide me how can I do that? I would really appreciate.
Only changing name doesn't create new package. You also need to make changes in build.gradle and in your MainActivity.kt.
If you want a simple solution. Directly use this package
and run this command
flutter pub run change_app_package_name:main com.new.package.name

Flutter web throws error on same project but different laptop

So I just won a new laptop in a competition and now I am having some trouble migrating my flutter projects. I have set up the editor and migrated the important files in the code, i.e the lib, image, font, pubspec.yaml and web. But this app is now throwing the following error
Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
ERROR - 2020-12-29 13:08:07.845202
GET /main_module.bootstrap.js
Error thrown by handler.
AbsoluteImportUriError: 'file:///C:/FlutterProjects/xspectre/lib/help/Auth.dart'
package:dwds/src/debugging/metadata/provider.dart 154:9 MetadataProvider._addMetadata
package:dwds/src/debugging/metadata/provider.dart 133:15 MetadataProvider._initialize.<fn>
I thought it may be a problem with my flutter but it runs the default flutter app without problem.
I also tried deleting the file but the problem just shifts to another file. I can safely say that this a is a problem with the help folder which provides me essential tools such as the auth service. What should I do? I will provide any code neccesary. You can find the entire code here
The Error:
The error is happening because when importing your new project, some imports in your .dart files are now using absolute paths instead of relative paths. In your case, this is happening at least in one .dart file that is calling your Auth.dart.
Sloution:
Step 1: Look at the top of all your .dart files, more precisely at every single import. You will have to change everything starting with:
import 'file:///C:/...
by
import 'package:... and add the name of your app
Step 2: Rerun your project and everything should work now
If still issues, then make sure you looked at all your files to ensure you did not miss other wrong import... also, you can run flutter clean then run a Pub Get
(thanks to melwinlobo18)
Please mark the answer if this was useful ;0)

google_fonts is not working in flutter after app build

when I am in debug mode, it's just working fine, but after app build, Google fonts is not working on the mobile, the app is using the regular font.
I checked and did all available steps to solve the issue,yet I failed!
Steps I did:
In my pubspec.yaml file, I added dependencies as instruction and added import 'package:google_fonts/google_fonts.dart'; in every file.Then I ran the "$flutter pub get" Command,then I restarted the IDE, when it returned the same result, then I did the whole procedure with the PC restart, but nothing changed.
I checked the android manifest file, and the line <uses-permission android:name="android.permission.INTERNET"/> is already there.
Switched the IDE VS code to android studio, still not working.
I deleted every related file from mobile, and restarted the mobile, i did a "Clean installation(?!)" with internet connection, but no joy!
Is there any way to solve the issue?
You need to download the font files from fonts.google.com and place them in a directory in top level directory of your application.
Also configure them jn pubspec.yaml as assets.
Follow the steps mentions here
https://pub.dev/packages/google_fonts