flutter_flavorizr icon indicating copy to clipboard operation
flutter_flavorizr copied to clipboard

How to use flutter:targets

Open danielRi opened this issue 3 years ago • 3 comments

Hi,

I have the follow scenario: I have a code base that needs to ship with 7 different Titles and Icons

-> Can be solved with flavors, works fine.

But each flavor needs to have different target builds, e.G. test, staging, production etc... Each target has own URLs for server endpoints (custom variables?) So you would have a 2D array of flavor/targets, if you want. 7 Flavors (doc, grumpy, bashful, etc..), with each flavor has 3 Targets (test, production, etc..), resulting in a combination of 21 different builds.

How to solve that?

The docu says about targets:

flutter:targets Flutter Creates a set of targets for each flavor instance

But how to use it? So far I tried this. If targets dont work, what can I use for my problem?

flavorizr:
  app:
    android:
      flavorDimensions: "flavor-type"
    ios:

  flavors:
    doc:
      app:
        name: "Doc"
    grumpy:
      app:
        name: "Grumpy"
    bashful:
      app:
        name: "Bashful"
    ...

  targets:
    test:
    staging:
    production:

danielRi avatar Mar 25 '22 04:03 danielRi

hey,

So... basically, in a pure android project you could use a set of dimensions (Android).

this repo only allow to use one dimension in android project....

but....

you could create something like:

flavors:
    doc-test:
      app:
        name: "Doc Test"

    doc-dev:
      app:
        name: "Doc Dev"

    doc-production:
      app:
        name: "Doc Prod"

JonathanAJ avatar Mar 28 '22 21:03 JonathanAJ

You need to define three times seven different flavors, each one for your particular destination at this time.

AngeloAvv avatar Apr 02 '22 18:04 AngeloAvv

Thanks so much for the help guys. We ended up using -dart--define in combination with flavorizr. Not perfect but its fine for now

danielRi avatar Apr 03 '22 02:04 danielRi

You need to define three times seven different flavors, each one for your particular destination at this time.

@AngeloAvv Is this still the recommended way of doing it with flavorizr? I have the same requirement, that I have multiple product flavors like "Corporate A", "Corporate B" and "Corporate C" and now I want to add my api flavors "production", "staging" and "development" for each product flavor.

I think for android it's possible to combine multiple dimensions of flavor, right? But is iOS the problem here?

sebastianbuechler avatar Jul 12 '23 19:07 sebastianbuechler

@sebastianbuechler unfortunately yes

AngeloAvv avatar Jul 12 '23 19:07 AngeloAvv