Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)

i got this Error i didn't know how i would to solve it any solution Please.

when i initialise firebase im main function it show me this white screnn and flutter icon:

enter image description here

enter image description here

but when i delete this initliation this firebase app run successfully as it is:

enter image description here

and show me those errors

enter image description here

like image 697
oussama Avatar asked Feb 28 '26 07:02

oussama


2 Answers

I just forget to add Google services plugin in android/app/build.gradle:

apply plugin: 'com.google.gms.google-services'
like image 53
ahmnouira Avatar answered Mar 03 '26 01:03

ahmnouira


Make sure you have firebase_core in your pubspec.yaml Then, just use the following in your main:

await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

run

flutter clean

and

flutter pub get

in your terminal.

If it still fails, please go step by step following the firebase documentation. It should work. https://firebase.google.com/docs/flutter/setup?platform=android

like image 28
Md. Kamrul Amin Avatar answered Mar 03 '26 02:03

Md. Kamrul Amin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!