14

We are planning to move our codebase to flutter, but we have some specific requirements and trying to validate them before moving all our codebase to flutter.

  1. With same codebase we are producing multiple targets in IOS and Android (In android its called flavors). And each target has different bundleId, application icons, launch images etc...
  2. For each target we have a scheme related with that target.
  3. We've 4 build configurations (Debug_Development,Debug_production,Release_Development,Release_production) to compile all of our targets.

I've looked at the below examples :

https://cogitas.net/creating-flavors-of-a-flutter-app/

https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36

But both of them were about creating multiple build configurations, but they don't mention about creating multiple targets.

So my question is , is it possible to create multiple targets and multiple schemes at the same time with flutter ? If its possible , how can we do that?

You can see our current applications scheme and target configurations in below screenshot: Targets Scheme Management

Thanks

tolgatanriverdi
  • 561
  • 9
  • 31
  • Check this: https://stackoverflow.com/a/53422162/11044061 – Fellipe Malta May 28 '19 at 01:14
  • I also have found this article, targeting directly using Flutter: https://medium.com/flutter-community/add-multiple-targets-in-flutter-apps-vs-code-android-studio-efe7e588e0cd – Fellipe Malta May 28 '19 at 01:16
  • Have you seen https://stackoverflow.com/a/51005687/884522? – Jacob Phillips May 30 '19 at 04:12
  • Check out my [ tutorial series ] (https://www.youtube.com/watch?v=DgGUtTUatDQ&list=PLUiueC0kTFqLdkuj4j8FNy1qlzcI0nyCu) , your problem in iOS will also be addressed in part 3 of this playlist. You will be able to use flavors in android and (Schems and build configurations in iOS) – dlohani Nov 28 '19 at 12:23

2 Answers2

2

I have a Youtube tutorial series on how to do this exactly. Following that, you will be able to separate environments in dart as well as native side and you will be able to use all the features available with Android flavors and iOS schemas and build-configurations. In the tutorial I have shown how to use two different firebase configurations for dev and production version in both iOS and Android. If you have any questions, you can comment

dlohani
  • 2,511
  • 16
  • 21
1

You can use build variants:

A flavour or a build variant can be multiple things, it can be used to target different device architectures or different backends. Android presents a separate distinction to both, so you can target different Android API versions and well as different backend support, for iOS I’m not quite certain, but it also does support these in some fashion.

and for doing this you need to modify the main.dart to support variants, here is the full article how this will work on different environments.

Payam Khaninejad
  • 7,692
  • 6
  • 45
  • 55