Flutter Flavors by Dart Define 🍦
A simple app showing how to use Flavors using Dart Defines (Thanks DeividWillyan for this helper) and show a flavor banner.
flutter run --dart-define=DEFINE_APP_NAME='[DEV] App Flavor' --dart-define=DEFINE_APP_SUFFIX=.dev
flutter run --dart-define=DEFINE_APP_NAME='[QA] App Flavor' --dart-define=DEFINE_APP_SUFFIX=.qa
If you wanna run this app on vsCode, just Copy/Paste this code bellow on your launch.json
on vsCode:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch development",
"request": "launch",
"type": "dart",
"args": [
"--dart-define",
"DEFINE_APP_NAME=[DEV] App Flavor",
"--dart-define",
"DEFINE_APP_SUFFIX=.dev"
],
},
{
"name": "Launch qa",
"request": "launch",
"type": "dart",
"args": [
"--dart-define",
"DEFINE_APP_NAME=[QA] App Flavor",
"--dart-define",
"DEFINE_APP_SUFFIX=.qa"
],
},
{
"name": "Launch production",
"request": "launch",
"type": "dart"
}
]
}