Set up Flutter flavors for Android

This guide shows you how to create Flutter flavors for an Android app.

Overview

A Flutter flavor when used with Android represents a unified term for various platform-specific features. For example, a flavor could determine which icon, app name, API key, feature flag, and logging level is associated with a specific version of your app.

If you want to create Flutter flavors for an Android app, you can do this in Flutter. In Android, a Flutter flavor is referred to as a product flavor.

The following illustrates an example of the Android build variants that are created when an Android app has two product flavors (staging, production) and two build types (debug, release):

Configure your product flavors

Complete the following steps to add two Android product flavors called staging and production to a new Flutter project called flavors_example, and then test your project to make sure that the flavors work as expected.