Tran Triet
Tran Triet

Reputation: 1307

How to have seperate builds with different screens/UI dev and product build with one code base in Flutter

I am building cross-platform with Flutter using Android Studio.

During my development process, I would like to use development tools like Flutter Redux Dev Tool which shows a debug screen right on the application UI like this

Flutter Redux Dev Tool

Or I can have my own debugging modules in the form of custom-styled print statements which I insert into different places in my codes.

I don't want to have to comment these debugging code out and/or switching out the appropriate UIs every time I need to build a product version

Are there ways to do this?

PS: I heard about build variants on Android Studio, is this the industrial way to solve this? If so, how to use it with Flutter

Upvotes: 2

Views: 356

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657496

One way is to use different entry-point files

flutter run -t lib/main_config1.dart
flutter build apk -t lib/main_config1.dart
...

You can then configure your application with different services (for logging or similar) depending on the requirements.

The --flavor options provides further ways for customization.

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

Upvotes: 2

Related Questions