Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple targets and multiple build configurations in flutter

Tags:

flutter

dart

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

like image 945
tolgatanriverdi Avatar asked May 20 '19 07:05

tolgatanriverdi


People also ask

What are the three different build modes in flutter?

Use debug mode during development, when you want to use hot reload. Use profile mode when you want to analyze performance. Use release mode when you are ready to release your app.

What are the supported target architecture in flutter?

aab . By default, the app bundle contains your Dart code and the Flutter runtime compiled for armeabi-v7a (ARM 32-bit), arm64-v8a (ARM 64-bit), and x86-64 (x86 64-bit).

Which of these is are Build Mode S in flutter?

There are 3 different build modes in flutter: Debug : This is the most common mode we always test the apps. If you are using Android Studio you can find its button on the top panel (a green play button). Release : This mode is for deploying the app on market places.

How do you debug in release mode flutter?

To display information that you would like to be visible in release mode ('production code') of your flutter app, simply use print() method. For info you want to hide in console log use debugPrint() .


Video Answer


2 Answers

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

like image 54
dlohani Avatar answered Sep 20 '22 09:09

dlohani


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.

like image 40
Payam Khaninejad Avatar answered Sep 17 '22 09:09

Payam Khaninejad