Flutter Flavours

Overview

Flutter Flavours

development enviroments

A demo using Flutter flavorizr to create multiples flavors(enviroments) in this case, i create four envs being them: Quality Assurance(Qa), Development(Dev), Homologation(Hom) and Production(Prod)

Steps to config

  1. add package flutter_flavorizr: ^2.0.0 in dev_enviroment
  2. add settings of enviroments in pubspec.yaml in my case is:
flavorizr:
  app:
    android:
      flavorDimensions:  "flavor-type"
    ios: null
  flavors:
    dev:
      app:
        name: "Flutter Flavor Dev"

      android:
        #bundle identifier
        applicationId: "br.com.flutter.flavor.dev"

      ios:
        bundleId: "br.com.flutter.flavor.dev"
    hom:
      app:
        name: "Flutter Flavor Hom"

      android:
        applicationId: "br.com.flutter.flavor.hom"

      ios:
        bundleId: "br.com.flutter.flavor.hom"
    qa:
      app:
        name: "Flutter Flavor qa"

      android:
        applicationId: "br.com.flutter.flavor.qa"

      ios:
        bundleId: "br.com.flutter.flavor.hom"
    prod:
      app:
        name: "Flutter Flavor"

      android:
        applicationId: "br.com.flutter.flavor"

      ios:
        bundleId: "br.com.flutter.flavor"
  1. generate code automatically with flutter pub run flutter_flavorizr -p android:androidManifest,android:buildGradle,flutter:flavors,flutter:app,flutter:pages,flutter:targets in this case i pass the params because i dont need to setting on ios. if you have ios run only flutter pub run flutter_flavorizr. This step add all config in android/app/build.gradle and ios directories to run the flavours

  2. If you need you can change icons in diferents flavors, to do that just simply add in android/app/src/ add res with resources of your app, with diferents logos.

  3. if you need, you can add diferents firebases enviroments, to do that just simply add google-services.json(Android) on android/app/src/ and when run has another enviroment. P.S.: Your CI can remove the unecessary enviroments to all devs has resources, with for example production keys of firebase

  4. in flavours.dart you can config to create base url to connect with api simply seeing the enviroment.

Steps to run the env

Run command above: flutter run --flavor -t lib/main_ .dart in my case to run dev enviroment i do: flutter run --flavor dev -t lib/main_dev.dart

And now your enviroments is separeted. if you have running on vscode, you can easyly add this setting in your project to run on debug diferents enviroments

  {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Development",
            "request": "launch",
            "type": "dart",
            "args": [
                "-t",
                "lib/main_dev.dart",
                "--flavor",
                "dev"
            ]
        },
        {
            "name": "Quality",
            "request": "launch",
            "type": "dart",
            "args": [
                "-t",
                "lib/main_qa.dart",
                "--flavor",
                "qa"
            ]
        },
        {
            "name": "Homologation",
            "request": "launch",
            "type": "dart",
            "args": [
                "-t",
                "lib/main_hom.dart",
                "--flavor",
                "hom"
            ]
        },
        {
            "name": "Production",
            "request": "launch",
            "type": "dart",
            "args": [
                "-t",
                "lib/main_prod.dart",
                "--flavor",
                "prod"
            ],
        },
    ]
}

Steps to build flavours

Run with command: flutter build --flavor -t lib/main_ .dart in my case to build appbundle prod enviroment i do: flutter build appbundle --flavor prod -t lib/main_prod.dart

You might also like...

Flutter demo application for Apple TV (tvos) using custom Flutter engine

Flutter demo application for Apple TV (tvos) using custom Flutter engine

Flutter for Apple TV A modification of the Flutter engine + test application to demonstrate that Flutter applications run on Apple TV This project (an

Dec 30, 2022

Udacity UI Clone made with Flutter Web (Flutter 2.0).

Udacity UI Clone made with Flutter Web (Flutter 2.0).

Udacity UI Clone Flutter Web 2.0 Description: Udacity UI Clone made with Flutter Web (Flutter 2.0). ScreenShots: Tools & languages: Android studio (ID

Oct 13, 2022

A Flutter application to demonstrate how to implement Google maps and its advanced options in a flutter app.

A Flutter application to demonstrate how to implement Google maps and its advanced options in a flutter app.

google_maps_flutter_example A new Flutter application to demonstrate how to implement flutter google maps in a flutter application and perfoem advance

Jan 8, 2023

🔥 A low-cost Flutter screen adaptation solution (类似今日头条屏幕适配方案,一个极低成本的 Flutter 屏幕适配方案)。

🔥 A low-cost Flutter screen adaptation solution (类似今日头条屏幕适配方案,一个极低成本的 Flutter 屏幕适配方案)。

screen_autosize 🔥 A low-cost Flutter screen adaptation solution (参考今日头条 Android 屏幕适配方案的实现原理,实现的一个极低成本的 Flutter 屏幕适配方案)。 Flutter 屏幕适配方案,可做到 100% 还原设计稿

Dec 17, 2022

:atom: 🚀 NLW Quiz Dev - Flutter (a simple flutter quiz app built in Rocketseat Next Level Week)

:atom: 🚀 NLW Quiz Dev - Flutter (a simple flutter quiz app built in Rocketseat Next Level Week)

Que tal acompanhar live codings de projetos reais ao vivo? Segue lá na twitch: Wilson Neto Dev na Twitch Next Level Week - Dev Quiz (NLW) Dev Quiz is

Jul 13, 2022

A re-modding of the Flutter 2.5 Skeleton App Template into something that really equally shows flutter best practices in DevOPS, OOP, and UX.

A re-modding of the Flutter 2.5 Skeleton App Template into something that really equally shows flutter best practices in DevOPS, OOP, and UX.

A re-modding of the Flutter 2.5 Skeleton App Template into something that really equally shows flutter best practices in DevOPS, OOP, and UX.

Dec 22, 2022

A simple flutter application which explains razorpay payment gateway integration with flutter.

A simple flutter application which explains razorpay payment gateway integration with flutter.

A simple flutter application which explains razorpay payment gateway integration with flutter.

Oct 24, 2021

Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size.

desktop_window Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size. Usage import 'package:desktop_window/desktop_window.dart

Dec 2, 2022

Sample flutter app for getting started with the Amplify Flutter Library.

Amplify Flutter Example Sample flutter app for getting started with the Amplify Flutter Library. This example uses the Auth, Analytics, and Storage co

Jan 19, 2022
Owner
Enzo Danjour
Flutter developer.
Enzo Danjour
Flutter Responsive Game of Thrones Flutter App Flutter Responsive Game of Thrones Flutter App

got_2019 A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Pawan Kumar 16 Jun 9, 2022
Flutter RxDart Explained - The Flutter Way Flutter RxDart Explained - The Flutter Way

rx_demo A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Pawan Kumar 27 Oct 13, 2021
Flutter social button - A flutter package to create social media login buttons easily to any flutter app

Flutter Social Button is a flutter package to create social media login buttons easily to any flutter app.

Alok Dubey 10 Dec 5, 2022
Flutter Gender Prediction App Flutter Gender Prediction App

gender_predictor A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Pawan Kumar 30 May 31, 2022
Beautiful Nike Web Design Concept With Flutter Beautiful Nike Web Design Concept With Flutter

flutter_web_nike A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Pawan Kumar 23 Jan 28, 2022
Flutter Music Player - First Open Source Flutter based material design music player with audio plugin to play local music files.

Flutter Music Player First Open Source Flutter based Beautiful Material Design Music Player(Online Radio will be added soon.) Demo App Play Store BETA

Pawan Kumar 1.5k Jan 2, 2023
Flutter Login Page Bloc Pattern App Flutter Login Page Bloc Pattern App

gdgbloc A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Pawan Kumar 99 Oct 20, 2022
Flutter: QR Code Scanner App Flutter: QR Code Scanner App

Flutter QRCode Scanner APP Show some ❤️ and star the repo to support the project A new Flutter project. Features Scan 2D barcodes Scan QR codes Contro

Pawan Kumar 250 Nov 10, 2022
Flutter: Integrate Google Maps Tutorial Flutter: Integrate Google Maps Tutorial

Flutter Google Maps APP Show some ❤️ and star the repo to support the project A new Flutter project. Getting Started Flutter Project Add this to your

Pawan Kumar 69 Oct 27, 2022
Create an Invoice PDF Document completely with Flutter and learn how to generate and view this invoice in Flutter.

Create an Invoice PDF Document completely with Flutter and learn how to generate and view this invoice in Flutter.

Johannes Milke 124 Jan 4, 2023