Trần Đức Tâm
Trần Đức Tâm

Reputation: 4453

Create build flavor on Flutter

I'm new on Flutter but I'm Android developer.

When I created a new Android project. I always prepare two build variant debug and release which provide me a BuildConfig.DEBUG variable with the value depended on which build variant I choose. I'm not sure about iOS. However, when I created a new Flutter project, I cant find the ways to point the gradle build me something like that.

Example code:

class RikimaruApplication extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Rikimaru Application",
      theme: ThemeData(),
      debugShowCheckedModeBanner: false,  \\ => debugShowCheckedModeBanner: BuildConfig.DEBUG,
    );
  }
}

Android Studio

I searched Google with flutter build variants key word but fail. Please teach me how to research about this problem.

Upvotes: 2

Views: 7909

Answers (2)

Vahab Ghadiri
Vahab Ghadiri

Reputation: 2430

there is no magic bullet for that. and it's easy i think.
you can use this link that is suggested by google :
https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36

and it can be in few steps :

-Creating new config files in flutter app ( each can have flavor to run ) .

enter image description here

-having that "Build flavor" name in android and ios .. android should be productFlavors...ios should be Schemas .. choose config for run in flutter and Well Done!

Upvotes: 0

Venkatesh Prasad
Venkatesh Prasad

Reputation: 103

The keyword word would be flutter flavour

And you can check this link for more information on flutter flavouring.

Upvotes: 1

Related Questions