Development Environments
Development Environments in FlutterFlow allow you to set up multiple environments for your apps, such as Development
, Staging
, and Production
. For each environment, you can create environment-specific values and databases. This allows you to easily point to different backends depending on where you are in your development lifecycle.
By default, every FlutterFlow project starts with a Production
environment.
- Dev Environment: Use for testing and developing new features without affecting production data.
- Staging Environment: Use to simulate the production environment before launching, and is isolated from the actual production data.
This is a common best practice, but you can create custom environments with different names for your own workflow.
Create and Switch Development Environments
You can create and switch environments in the Dev Environments page in App Settings. You can always see the current environment that is selected by looking in the top left hand corner of the project.
The selected environment is used to generate the proper app code when you run, test, deploy or export your app. The only things that change between environment are the Firebase Project or variables that are tied to Environment Values
Use Environment Values
Environment Values can be used to dynamically change parts of your app's code based on the environment that is being used.
For example, in an e-commerce app, you might define an apiUrl
Environment Value that points to different API URLs for Development, Staging, and Production. This allows you to test new features without affecting the live production environment, where real customer orders are processed.
Let's see an example of creating and using apiUrl
:
After switching to an environment, FlutterFlow generates code specific to that environment, for any of the following interactions:
- Test / Run mode sessions
- Local Run
- Code export
- Deployment
You also may see different project errors depending on which environment you have selected.
Configuring Firebase for each Environment
A single FlutterFlow project can have multiple environments, each mapped to its own Firebase project. This ensures that environments like Development
, Staging
, and Production
remain independent, giving you better control over your app's data and behavior throughout different stages of development.
If your project uses Firebase, you'll need to manually configure a new Firebase project for each environment. This requires setting up a new project in the Firebase console and linking it to the selected environment in FlutterFlow.
- You must complete the Firebase setup for the new environment before you can test your app using that environment. However, this doesn't stop you from continuing to run and test your app in other environments. Just switch back to production, and you can keep testing while finishing the setup for the new environment.
- You must manually set up Firestore rules and collections for the new environment.
- Data that you add to Firebase through the Content Manager is specific to the Firebase project, and environment, that you have selected
FAQ
How can you push code from one environment to another?
It’s important to note that the Development Environments feature in FlutterFlow is primarily designed to configure different backends for testing
If you are building new features, you should consider using Branching. You can develop and test new features on a new branch by selecting a development environment. Once tested, you can merge the branch into main
and switch to the Production
Environment to go live.
Are you using Flutter flavors under the hood?
No, FlutterFlow does not use Flutter flavors. Instead, it generates code based on the environment selected in FlutterFlow. The environment-specific code is generated and applied for the following actions:
- Test / Run mode sessions
- Local Run
- Code export
- Deployment