Flutter — Separating Build Environment with Multiple Firebase Environment

Damodar Lohani
1 min readApr 18, 2019

Developing professional mobile applications, requires at least two different environments: a development where we test new features and a production where only the stable features are merged. Having two separate environment allows us to keep adding features to our app, keep testing without accidentally breaking anything for the production users.

Developing flutter applications with Firebase as backend, requires us to have separate build environments as well as must allow us to use separate Firebase project for each environment so that test data does not pollute the production data.

In this tutorial, we will learn to separate build environments in flutter as well as setup native apps so that we can use multiple Firebase configurations.

All the required code for this tutorial is available in my Github repository

Part 1: In this part, we will learn to separate build environment and configs in dart side, we will learn to create separate main files each for the build flavors we want and apply different configs to each app.

Part 2: In part 2 we will learn to setup flavors in android side which will allow us to use two separate firebase configs based on flavors in our flutter project in android.

Part 3: In part 3 we will learn to setup schema in iOS side, and make our flutter app able to use separate Firebase config in iOS.

--

--