flutterfirebasedartproduction

How to connect two Firebase projects to one Flutter project for production and staging environments


Does anyone know how to connect two Firebase projects to one Flutter project? I would like to have one for production data and another for testing/staging data.

The problem that I am running into is that the GoogleService-Info.plist file can't have a unique name so I can only have one of those files.

Has anyone successfully done this or have an easier way to separate the data for environments using Firebase/Flutter?


Solution

  • To use different Firebase projects for production and staging environments, you have to use flavor.

    With flavor, you can define environment-specific configuration for production and staging environments.

    Here is the tutorial on how to set up flavor and configure firebase project for different environments