You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix a bug with the demoProjectId arg to Firebase.initializeApp()
If platform specific configuration files exist for the project (i.e.
GoogleService-Info.plist for iOS), the default `MethodChannelFirebaseApp` is
initialized using the configuration it specifies. This is fine since multiple
`FirebaseApp` instances can exist, however when
`MethodChannelFirebase.initializeApp()` is called it uses the default app name
(`[DEFAULT]`, from the code) if no name is passed as an argument. Since the
default app is initialized using the platform specific configuration before
`initializeApp()` is called, the user provided options are ignored.
The solution is to ensure a non-null app name is passed to `initializeApp()` to
avoid conflicts with platform specific configuration files when the user intends
to use a "demo-" project for testing.
Since we should be providing a distinct app name for the demo app, the
allowance for mismatched options between the specified options and the existing
options for demo apps is also removed.
Copy file name to clipboardExpand all lines: packages/firebase_core/firebase_core_platform_interface/lib/src/method_channel/method_channel_firebase.dart
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -121,9 +121,7 @@ class MethodChannelFirebase extends FirebasePlatform {
121
121
// check to see if options are roughly identical (so we don't unnecessarily
122
122
// throw on minor differences such as platform specific keys missing
123
123
// e.g. hot reloads/restarts).
124
-
if (defaultApp !=null&&
125
-
_options !=null&&
126
-
!_options.projectId.startsWith('demo-')) {
124
+
if (defaultApp !=null&& _options !=null&&) {
127
125
if (_options.apiKey != defaultApp.options.apiKey ||
0 commit comments