2

I have embedded the flutter module in my iOS project. I use firebase in native project. Now I want to use firebase in flutter module too. But when I try to call Firebase.initializeApp() in flutter main, the engine seems stuck and no page is rendered.

How can I use firebase in flutter module? Are they the same instance?

void main() async {
  await Firebase.initializeApp();

  runApp(const MyApp());
}
Ming
  • 21
  • 1
  • 1
    If you add Flutter module, Firebase creates firebase_options.dart file under lib folder and you need to initialize like that. await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); – Burak Aybi Aug 05 '22 at 10:04
  • Thanks for your reply. In my case, my native didn't use flutterfire to init firebase. I add the plist file mannully. The reason why firebase fails to init is that the plist file is not in the root directory. – Ming Aug 08 '22 at 11:07

1 Answers1

0

In my case, I don't use flutterfire to init firebase. I added the plist file to navite project. Also I fail to use flutterfire to init in flutter module because there is no folder named ios but .ios. Finally I find that the reason is the plist file is not in the root directory. In native module I call FirebaseOptions(contentsOfFile:) method to init firebase. Also I rename the plist in order to support different target of project. But in flutter module, it doesn't support to init firebase with specidic plist file. Eventually after I move the plist file to root directory and rename it, firebase inits successfully and works normally.

Ming
  • 21
  • 1
  • Hello, i am experiencing the same problem and we have the same setup in our project. can you tell what naming did you change? any help could be very usefull, thank you. – grisVladko Jan 12 '23 at 10:42