In the run console
Launching libmain.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Parameter format not correct -
√ Built buildappoutputsflutter-apkapp-debug.apk.
Installing buildappoutputsflutter-apkapp-debug.apk...
Debug service listening on ws://127.0.0.1:6400/pR_lm1UHzmA=/ws
Syncing files to device Android SDK built for x86...
E/flutter ( 5558): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)
E/flutter ( 5558): #0 FirebaseCoreHostApi.optionsFromResource (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:248:7)
E/flutter ( 5558): <asynchronous suspension>
E/flutter ( 5558): #1 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:89:25)
E/flutter ( 5558): <asynchronous suspension>
E/flutter ( 5558): #2 Firebase.initializeApp (package:firebase_core/src/firebase.dart:43:31)
E/flutter ( 5558): <asynchronous suspension>
E/flutter ( 5558): #3 main (package:ncc_apps/main.dart:8:3)
E/flutter ( 5558): <asynchronous suspension>
E/flutter ( 5558):
void main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(const MyApp());
}
`when i remove await .. its working. what should i do?
firebase integrate properly.`
2
Answers
First, you need to initialize Firebase on your project using Firebase CLI.
You can start with
firebase init
, after Firebase setup you will getfirebase_options.dart
which contains your project configuration, your main function will be likeAdd these dependencies in your
pubspec.yaml
filethen inside
main.dart
fileif you are setting firebase for push notifications add these 2 also in
pubspec.yaml
Then finally, Install FlutterFire CLI from https://firebase.google.com/docs/cli#setup_update_cli
then open terminal and use command below and follow instruction
this will generate firebase_options.dart file.
Also to implement push notifications you can add this code (create new file firebase_api.dart)
and in main.dart file
make you widget stateful (if not) and then use init method for using this code,