Ahmed Morra
Ahmed Morra

Reputation: 139

Secondary firebase project in flutter app

I need two separate environments dev and prod for my flutter app

Regarding the coding part I will use development branch and Master branch to sperate production from development

but regarding firebase I want to have Two firebase projects connected to my flutter and I don't like the flavors way

in flutter core docs they share this code to initialize a second firebase app

await Firebase.initializeApp(
    name: 'SecondaryApp',
    options: const FirebaseOptions(
        appId: 'my_appId',
        apiKey: 'my_apiKey',
        messagingSenderId: 'my_messagingSenderId',
        projectId: 'my_projectId'
    )
);

this part

        apiKey: 'my_apiKey',
        messagingSenderId: 'my_messagingSenderId',
        projectId: 'my_projectId'

I can get from firebase project settings

but where do I get the

appId: 'my_appId',

part?

Is it the same flutter app id from the first firebase project or I am missing something?

Upvotes: 1

Views: 811

Answers (1)

Itamar Garcia
Itamar Garcia

Reputation: 906

The appId is the unique identifier for the Firebase app across all of Firebase with a platform-specific so is diferent for android and ios, you can find it at the Proyect Settings button > Your apps section, to learn more about Firebase Proyect Settings check this page https://firebase.google.com/docs/projects/learn-more

Upvotes: 2

Related Questions