Accessing the default Firebase app instance is not possible if the instance was initialized in the native part of the app #10999
Unanswered
gaburielcasado
asked this question in
Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I realize this might be a corner case, but utilizing this library in Flutter for the default app instance (and crashlytics/analytics) is pretty much impossible if you are adding Flutter modules to a native app. In my case, I have an Android and iOS app that both use Firebase and both initialize the default Firebase instance on the native side.
Then, if you try to get the default firebase app instance on the Flutter side, it is not possible as the only way to do that is by initializing the Firebase app, which will throw an error because it was already initialized. It would be nice if this library had a method that allows us to get a firebase app instance from the native library instead of using the values that are cached from calling initializeApp.
In case I'm not clear, here's the step by step:
1 - On a native app, iOS or Android, initialize the default Firebase app instance
2 - On the flutter module that is being utilized by the native app, try to get the default Firebase app instance
3 - Error, as the Firebase Flutter library will complain the default Firebase app instance was not initialized
4 - Try to initialize the default Firebase app instance on the Flutter side.
5 - Error, as an error will be thrown, describing that the default Firebase pap instance was already initialized
Another solution would be to add support to Crashlytics/Analytics so that they allow using other Firebase app instance instead of only the default app instance. This would also bring many other benefits.
Beta Was this translation helpful? Give feedback.
All reactions